- git fetch upstream
- git branch --list -a
- git merge upstream/master
- git push origin
- git rebase -i HEAD~3 # edit last 3 commits
- git merge-base master upstream/master find common ancestor.
- git reset <commit> # Move current branch head to this commit
- git reset --hard # discard all local changes.
- # rebase branch xyz with master
- git co xyz
- git rebase master
- # pretty graph output
- # git log --graph --all --decorate --oneline
- # git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
- # deleting a branch
- git branch -D <branch> # local remove
- git push origin --delete <branch> # remote remove
- git fetch -p # in case you have origin/<branch> locally, but remote is already gone
- # this fetches stale stuff as well, thus deleting the origin/<branch>