git
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
git [2022/04/08 08:23] – Add instructions for rebasing dblume | git [2022/04/25 11:43] – dblume | ||
---|---|---|---|
Line 58: | Line 58: | ||
< | < | ||
- | git push -u origin | + | git push -u origin |
</ | </ | ||
Line 77: | Line 77: | ||
git commit -m "first commit" | git commit -m "first commit" | ||
git remote add origin https:// | git remote add origin https:// | ||
- | git push -u origin | + | git push -u origin |
- | </ | + | |
- | + | ||
- | ===== Creating a new remote repository from an existing local one ===== | + | |
- | + | ||
- | I created wine-tasting at [[https:// | + | |
- | + | ||
- | < | + | |
- | ~$ mkdir wine-tasting | + | |
- | ~$ cd wine-tasting/ | + | |
- | wine-tasting$ vim README.md | + | |
- | wine-tasting$ vim LICENSE.txt | + | |
- | wine-tasting$ git init | + | |
- | wine-tasting$ git add README.md | + | |
- | wine-tasting$ git add LICENSE.txt | + | |
- | wine-tasting$ git add test.py | + | |
- | wine-tasting$ git add wine_allocator.py | + | |
- | wine-tasting$ git commit -m "first commit" | + | |
- | wine-tasting$ git remote add origin https:// | + | |
- | wine-tasting$ git push -u origin master | + | |
</ | </ | ||
Line 156: | Line 137: | ||
<code bash> | <code bash> | ||
git checkout -b bugfix/ | git checkout -b bugfix/ | ||
- | # If main is getting updated, | + | |
+ | # If main is getting updated, rebase like so: | ||
# git checkout main | # git checkout main | ||
# git pull | # git pull | ||
# git checkout bugfix/ | # git checkout bugfix/ | ||
# git rebase main | # git rebase main | ||
+ | |||
+ | # Consider whether you want to squash commits before pushing | ||
+ | # git reset --soft HEAD~3 | ||
+ | |||
git commit -m "fixed bug" | git commit -m "fixed bug" | ||
git push --set-upstream origin bugfix/ | git push --set-upstream origin bugfix/ | ||
Line 190: | Line 176: | ||
... | ... | ||
testcode$ git remote add origin ssh:// | testcode$ git remote add origin ssh:// | ||
- | testcode$ git push origin | + | testcode$ git push origin |
</ | </ | ||
I could' | I could' | ||
git.txt · Last modified: 2024/04/11 16:58 by dblume