Rename a local branch: git branch -m branch-name
Delete a local branch: git branch -d branch-name
Delete a remote branch: git branch -dr origin/branch-name
Remove local branches which are no longer available on the remote: git fetch -p
Undo non-pushed commits: git reset origin/master
Undo the last commit: git reset HEAD~ --hard
Undo the last commit, but leave the changes available: git reset HEAD~ --soft
Revert file to origin branch's version: git checkout origin/master file_name
Sync local branch with remote branch: git fetch --all && git reset --hard origin/master
Change message of last commit: git commit --amend -m "New message"
Visual representation of the branch merging into master: git log --oneline --graph
View unpushed git commits: git log origin..
See previous git commands executed: history | grep git