git add .
- select all
git add . -p
- select specific chunks
git add src
- directory only
git status
git commit -m "<Verb> <Noun>"
- Recommend explicit commit messages, such as
git commit -m "Add unit test for myFunction()"
git push
- commits branch to remote
git push --set-upstream origin <branch>
- create upstream reference and commits branch to remote
git checkout -b <new-branch>
git stash
- creates a stash of current staged files
git stash list
- shows what's stashed
git stash pop
- Apply stashed, last in first out
git pull origin master --rebase
- Do this once a day to keep branch up to date on your branch
git rebase -i HEAD~2
Useful ones: squash
, reword
, drop
git reflog
git reset --hard <SHA OF LAST GOOD COMMIT>
git commit --fixup <SHA OF COMMIT TO FIX>
git rebase -i --autosquash master