Git Reference ยท Configuration Options
rebase.* settings
Reference for rebase.* settings: rebase.autoSquash, autoStash, updateRefs, missingCommitsCheck, instructionFormat and rebaseMerges, with runnable examples.
The rebase.* settings change how git rebase behaves by default so you do not have to repeat flags. Three are worth knowing by heart: rebase.autoSquash (apply fixup! and squash! commits automatically), rebase.autoStash (save and restore uncommitted changes around the rebase) and rebase.updateRefs (move other branches that point into the rebased range).
git config --global rebase.autoSquash true git config --global rebase.autoStash true git config --global rebase.updateRefs true
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
git config rebase.autoSquash (true | false) git config rebase.autoStash (true | false) git config rebase.updateRefs (true | false) git config rebase.missingCommitsCheck (ignore | warn | error) git config rebase.instructionFormat <format> git config rebase.rebaseMerges (true | false | rebase-cousins | no-rebase-cousins) git config rebase.abbreviateCommands (true | false) git config rebase.forkPoint (true | false) git config rebase.stat (true | false) git config rebase.backend (merge | apply)
| Name | Description |
|---|---|
rebase.autoSquash |
In interactive rebases, move fixup!/squash!/amend! commits next to their target and mark them automatically. |
rebase.autoStash |
Stash uncommitted changes before the rebase and pop them afterwards (same as --autostash). |
rebase.updateRefs |
Branches pointing at rebased commits are moved too, which makes stacked branches painless (Git 2.38+). |
rebase.missingCommitsCheck |
What to do when you delete a line from the todo list: ignore (default), warn or error. |
rebase.instructionFormat |
git log format used for each todo line; %s is the default. |
rebase.rebaseMerges |
Keep merge commits instead of flattening them (same as --rebase-merges). |
rebase.abbreviateCommands |
Write p, f, s instead of pick, fixup, squash in the todo list. |
rebase.forkPoint |
Use the reflog fork point as the default upstream base; false uses the plain upstream tip. |
rebase.stat |
Show a diffstat of what changed upstream after rebasing. |
Errors: a rebase with uncommitted changes and no auto-stash fails with error: cannot rebase: You have unstaged changes.. With rebase.missingCommitsCheck=error, removing a pick line aborts with the list of dropped commits.
Usage notes
autoSquashpairs withgit commit --fixup <commit>. You commit the correction now and let the nextgit rebase -ifold it into the right commit. It only has an effect in interactive mode.- To squash without opening an editor, set
GIT_SEQUENCE_EDITOR=:for that command, as the first example does. autoStashcan conflict. If the stash does not apply cleanly after the rebase, Git keeps it and tells you; resolve then withgit stash pop.updateRefsonly moves branches that point at commits inside the rebased range, and not the current branch's remote-tracking ref. Check withgit log --decorate.- Backend: the merge backend is the default;
rebase.backend=applyis only needed to get oldgit am-style behavior and is deprecated. - Interaction with pull:
git pull --rebasehonors these settings; seepull.rebase. - Rewriting shared history is still dangerous, no matter how convenient the defaults are.