⌘ CheatSheet
← Library

🌿Git

Everyday Git commands — branches, stashing, history surgery.

CLI Tools · 3 sections

Edit

Stash

git stashStash tracked changes
bash
git stash
git stash popApply + drop the newest stash
bash
git stash pop
git stash listList all stashes
bash
git stash list
git stash applyApply a specific stash without dropping it
bash
git stash apply stash@{2}

Branching

New branch + switchCreate and switch in one step (Git 2.23+)
bash
git switch -c feature/login
Delete a branch-D forces delete of unmerged branches
bash
git branch -d feature/login
Rename current branch
bash
git branch -m new-name

History

Pretty log
bash
git log --oneline --graph --decorate --all
Undo last commit, keep changes
bash
git reset --soft HEAD~1
Amend commit messageNever amend pushed commits
bash
git commit --amend -m 'better message'