Include all of the standard workflow commands I use. Ex:
Standard beginner workflow
git status
git checkout main
git pull
git branch gstaples_feature1
git checkout gstaples_feature1
# make changes
git difftool
git add -A
git commit
git push -u origin gstaples_feature1
# make more changes
git difftool
git add -A
git commit
git push
# open pull request online
# once merged, pull new latest `main` and delete old feature branches (local and
# remote), and begin another branch for your next feature
git checkout main
git pull
git branch -d gstaples_feature1 # delete old local branch
git push origin :gstaples_feature1 # delete old remote branch
git branch gstaples_feature2
git checkout gstaples_feature2
Standard intermediate workflow (identical in function to the above)
This simply replaces a few commands above where 2 or more commands can be replaced by 1 single command instead. So, the function is identical to the function above, but it's more efficient is all. This is closer to what I normally do.
git status
git fetch origin main:main
git checkout -b gstaples_feature1 main
# make changes
git difftool
git add -A
git commit
git push -u origin gstaples_feature1
# make more changes
git difftool
git add -A
git commit
git push
# open pull request online
# once merged, pull new latest `main` and delete old feature branches (local and
# remote), and begin another branch for your next feature
git fetch origin main:main
git checkout -b gstaples_feature2
git branch -d gstaples_feature1 # delete old local branch
git push origin :gstaples_feature1 # delete old remote branch
Resolve merge conflicts by "rebasing (merge-style) onto latest main"
Beginner:
git status
git checkout main
git pull
git checkout gstaples_feature1
git branch gstaples_feature1_BAK_20220102-1300hrs_about_to_merge
git merge main
# manually resolve conflicts in each file
git add -A
git merge --continue
git status
git push
Intermediate:
git status
git checkout gstaples_feature1
git fetch origin main:main
git branch gstaples_feature1_BAK_20220102-1300hrs_about_to_merge
git merge main
# manually resolve conflicts in each file
git add -A
git merge --continue
git status
git push
Regardless of which method you choose above, you can now see only your gstaples_feature1 branch commits like this. Read ^main as not on branch main. If you just do git log, you'll see other peoples' upstream (and now merged into your branch) commits intermingled with yours. This can be very confusing and distracting.
keywords: git cheatsheet cheat sheet, etc.
Include all of the standard workflow commands I use. Ex:
Standard beginner workflow
Standard intermediate workflow (identical in function to the above)
This simply replaces a few commands above where 2 or more commands can be replaced by 1 single command instead. So, the function is identical to the function above, but it's more efficient is all. This is closer to what I normally do.
Resolve merge conflicts by "rebasing (merge-style) onto latest main"
Beginner:
Intermediate:
Regardless of which method you choose above, you can now see only your
gstaples_feature1
branch commits like this. Read^main
as not on branchmain
. If you just dogit log
, you'll see other peoples' upstream (and now merged into your branch) commits intermingled with yours. This can be very confusing and distracting.Other tools
git lg
- https://coderwall.com/p/euwpig/a-better-git-loggit changes
git blametool
git branch_
git difftool main...HEAD
vsgit difftool main..HEAD
git cherrypick
main~
,main~2
,main^
, etc.