Git - kimschles/schlesinger-knowledge GitHub Wiki
Git Docs
git --helpgit help -a
Seeing The Commit History (yours and the team's)
git statusgit log --onelinegit log --oneline --allgit log --oneline --all --decorate
Merge
Rebase
rebaserebase -i<- This one gives you options and explanations. :)- Usually, the command is
git merge -i origin/master
Merge vs. Rebase
- A merge preserves your branch history, while rebase does not.
- A merge is useful for combining changes that are public
- Rebase is good for combining changes that are only on your machine
Fetch vs. Pull
Finding the sha of a particular branch or commit
git show-ref
Looking at diffs
See the difference between two different shas
git diff sha~sha2See the difference between your head and the last commitgit diff HEAD~1
Revert
git revert shaRevert a merge commit (choose the first sha)git revert -m 1
Tags
Add a git tag:
* git tag 2.1
Look at git tags:
* git tag
Push up a git tag:
* git push origin --tags
Learning Resources:
- https://learngitbranching.js.org/
- Find
rebaseunder ‘Advanced Topics’
- Find
- https://www.shortcutfoo.com/app/dojos/git
- https://www.youtube.com/watch?v=tukOm3Afd8s
- https://www.youtube.com/watch?v=dO9BtPDIHJ8
- https://www.youtube.com/watch?v=SxzjZtJwOgo
Look at your SSH env variable(s):
env | grep -i git
-imeans to ignore case. You can also use--ignore-case