Git CLI
November 21, 2019
Git Cheat Sheet
My go to cheat sheet from git-tower
Other Git Commands
Other git commands that I’ve found useful over the years.
Create local tracking branch from remote branch (option a)
git fetch
git checkout <branch>
Create local tracking branch from remote branch (option b)
git checkout --track <remote/branch>
Push and set up remote tracking branch from local branch
git push -u <remote> <branch>
Delete a remote branch
git push --delete <remote> <branch>
Single line git logs
git log --oneline
Remove untracked files (dry run)
git clean -n
Remove untracked files (for real)
git clean -i
Local prune
git prune
Remote prune
git remote prune <remote>
Built-in Git GUI
gitk
Git Tags
List tags
git tag
Add annotated tag
git tag -a <tagname> -m <message>
Push single tag to remote
git push <remote> <tagname>
Push all tags to remote
git push <remote> --tags
Delete local tag
git tag -d <tagname>
Delete remote tag
git push --delete <remote> <tagname>
A blog written by Marty Sanchez, a web developer who lives and works in San Diego.