Git Command Generator
Describe what you want to do with Git and get the exact command without memorizing complex syntax.
30 commands
Create and switch to a new branch
git checkout -b <branch-name>Stage all changes
git add .Stage specific file
git add <file>Commit with a message
git commit -m "<message>"Amend the last commit message
git commit --amend -m "<new-message>"⚠ Only amend unpushed commits
Push current branch to origin
git push origin HEADPull and rebase onto origin
git pull --rebase origin <branch>Merge branch into current
git merge <branch-name>Rebase current onto another branch
git rebase <base-branch>Stash uncommitted changes
git stash push -m "<description>"Apply most recent stash
git stash popList all stashes
git stash listUndo last commit but keep changes
git reset --soft HEAD~1Discard all local changes
git checkout -- .⚠ Irreversible — use with caution
View commit log (pretty)
git log --oneline --graph --decorate --allShow what changed in last commit
git show HEADShow diff of unstaged changes
git diffShow diff of staged changes
git diff --cachedCherry-pick a commit
git cherry-pick <commit-hash>Tag the current commit
git tag -a v<version> -m "<message>"Delete a local branch
git branch -d <branch-name>Delete a remote branch
git push origin --delete <branch-name>Fetch and prune deleted remote branches
git fetch --pruneFind which commit introduced a bug (bisect)
git bisect start
git bisect bad
git bisect good <known-good-commit>See who changed each line of a file
git blame <file>Search commit messages
git log --all --grep="<keyword>"Reset file to version in last commit
git checkout HEAD -- <file>Squash last N commits
git rebase -i HEAD~<N>Clone a specific branch
git clone -b <branch> <repo-url>Set upstream for current branch
git branch --set-upstream-to=origin/<branch>