Git - kimschles/schlesinger-knowledge GitHub Wiki
Git Docs
git --help
git help -a
Seeing The Commit History (yours and the team's)
git status
git log --oneline
git log --oneline --all
git log --oneline --all --decorate
Merge
Rebase
rebase
rebase -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~sha2
See the difference between your head and the last commitgit diff HEAD~1
Revert
git revert sha
Revert 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
rebase
under ‘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
-i
means to ignore case. You can also use--ignore-case