- rename branch: git branch -m
- set local branch to track remote branch: git branch --set-upstream develop origin/develop
- see remote origin: git remote -v
- change remote origin url: git remote set-url origin <url>
- remove remote: git remote rm <name_of_remote_to_remove>
- see tags: git tag -l
- checkout tag: git checkout tags/<tag_name>
git stash
git branch <branch_name>
git checkout <branch_name>
git stash apply
git stash save "abc"
git stash apply stash^{/abc}
git reset --soft HEAD^
git stash
git co
git stash apply
- undo commit: git config --global alias.undo-commit 'reset --soft HEAD^'
- unpushed commits: git config --global alias.unpushed "log --branches --not --remotes --simplify-by-decoration --decorate --oneline"
- checkout: git config --global alias.co "checkout"
- list branches: git config --global alias.ba "branch -a"
- last commit: git config --global alias.last=log -1 HEAD --stat
Or just the git plugin by Oh My Zsh.