All commands below are mnemonics — each letter stands for a word, so the alias hints at what it does (e.g. pf = push force, ru = rebase upstream).
- Switches to a selected branch (default branch by default —
mainormaster, auto-detected) - Pulls changes from the remote server
- Deletes all local branches which were deleted remotely
git goSame command, but with another branch name to switch to:
git go feature/custom-branch-nameFetches the latest changes for the default branch (main/master) from the remote.
- If you are currently on the default branch, runs
git pull --ff-onlyto update your working tree. - If you are on any other branch, fast-forwards the local default branch without switching to it — so you can rebase onto an up-to-date base without leaving your feature branch.
git fOpens an interactive rebase for all commits in the current branch that are not yet in the default branch, automatically calculating the number of commits to rebase.
Useful for squashing or editing only your new commits.
git rhOpens an interactive rebase of the current branch on top of the default branch, using it as the fixed base.
All commits in the branch will be reordered relative to the default branch.
git ruAborts an in-progress rebase and returns the branch to its pre-rebase state.
git raForce push with --force-with-lease flag — safer than plain --force because it refuses to overwrite remote commits you haven't seen.
git pfDiscards all local changes and aborts any in-progress rebase:
- Resets the working tree to
HEAD(git reset --hard) - Removes untracked files and directories (
git clean -df) - If a rebase is in progress, aborts it
git nahPrints the name of the remote's default branch (main, master, etc.).
Used internally by the other aliases so they work regardless of branch naming convention.
Requires a one-time setup per repo so Git knows which branch is the default:
git remote set-head origin --autoIf the remote HEAD is not set, falls back to master.
git defaultPrunes remote-tracking references and deletes all local branches whose upstream has been removed (shown as : gone] in git branch -vv).
Called automatically by git go, but can be run on its own.
git cleanupPrints the number of commits on the current branch that are not yet in the default branch.
Used internally by git rh to figure out how far back to rebase.
git count