Everyday

git status -sb                  # short status with branch info
git log --oneline --graph -20   # compact graph
git diff --staged               # what's about to be committed
git add -p                      # interactively stage hunks
git commit --amend --no-edit    # fix the last commit's files, keep the message

Undoing

git restore <file>              # discard unstaged changes
git restore --staged <file>     # unstage without losing edits
git reset --soft HEAD~1         # uncommit last commit, keep changes staged
git reflog                      # find a commit you thought you lost

Branches

git switch -c feature/x         # create + switch
git switch -                    # jump back to previous branch
git branch -vv                  # see tracking branches
git push -u origin feature/x    # push + set upstream

Submodules

git clone --recurse-submodules <url>
git submodule update --init --recursive   # after a plain clone
git pull --recurse-submodules             # update parent + submodules

Rewriting

git rebase -i HEAD~5            # squash, reorder, edit last 5 commits
git commit --fixup <sha>        # mark a commit for autosquash
git rebase -i --autosquash HEAD~10

Remotes

git remote -v                   # list remotes
git remote set-url origin <url> # swap remote
git fetch --all --prune         # tidy up deleted remote branches