skip navigation
"Software developer with a kaizen mindset"

My git cheatsheet

Friday Nov 26, 2021 | updated Nov 29, 2021

These are the commands I generally use the most or ones that are very useful but don’t use frequent enough to remember.

Command Comment
git stash Shelving changes temporarily to for example change branches without having to commit them
git stash pop Retrieve the shelved changes
git checkout branch_name Switching branches
git rebase branch_name Rewrite history and reapply your branch at the head of the other branch
git fetch Get remote branches and/or tags
git pull Update your local repository
git push Push changes to remote repository
git status -s -b Show current branch and all changed + untracked files
git commit -m “some comment” Commit changes to local repository
git log -n Get the last n commits and their description
git log hash..hash Get commits between these commits, alternatively use tags or HEAD instead of hashes
git add –all Stage changes. Option –all updates the index not only where the working tree has a file matching but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree. If no is given when -A option is used, all files in the entire working tree are updated (old versions of Git used to limit the update to the current directory and its subdirectories).
Share on: