I know how to do a git rebase from the command line, but how do you do it with the official git-gui?
4 Answers
Add this to the .gitconfig
file in your home directory to add rebase commands to the Tools menu:
[guitool "Rebase onto..."]
cmd = git rebase $REVISION
revprompt = yes
[guitool "Rebase/Continue"]
cmd = git rebase --continue
[guitool "Rebase/Skip"]
cmd = git rebase --skip
[guitool "Rebase/Abort"]
cmd = git rebase --abort
[guitool "Pull with Rebase"]
cmd = git pull --rebase

- 8,526
- 3
- 43
- 43
-
3To the cmd line (2nd line), you need to add $REVISION, i.e. cmd = git rebase $REVISION. Otherwise, thanks! I had no idea this capability existed. – Jim Raden Feb 18 '14 at 17:01
-
Interactive rebase is also possible, you just have to set the env-var EDITOR to a gui editor. I considered this too much of an edit to add to your answer so I created my own -- feel free to add my answer to yours. – Irfy Mar 02 '14 at 22:50
-
Some window appears, but what to enter in these fields? – Paul May 30 '14 at 07:23
-
I found Jim Raden's comment to be correct, $REVISION is required instead of $VERSION. Perhaps Ted Percival could edit his answer? I'd do it but I am not sure if $REVISION is universally correct, or platform specific or something. – Tony Park Jul 15 '14 at 13:06
In git-gui
:
- Go to
Tools -> Add
and then enter a custom command i.e.git rebase master
. - Select Add globally to have this option appear for all repositories. (It will write the configuration to your
~/.gitconfig
for you, as @Ted-Percival mentioned in his answer).

- 1
- 1

- 13,561
- 5
- 60
- 64
-
2Worth pointing out that your local Git database must be up-to-date with changes of the branch you wish to rebase onto. If the local `master` has not been updated since you branched, `git rebase master` does nothing! To resolve this, first run `git checkout master; git pull; git checkout MY_BRANCH` from the command-line, or change the `git-gui` command to `git rebase origin\master`. – AlainD Jul 01 '20 at 16:00
You can do a full interactive rebase with git gui
, complete with commit selection, rewording and conflict resolution! In addition to Ted Percival's answer, Add this to your ~/.gitconfig
:
[guitool "Rebase interactive"]
cmd = EDITOR=gvim git rebase -i $REVISION
revprompt = yes
You must use a graphical editor -- plain old vim
won't work, but gvim
will. You may use any gui editor, I use nedit
for example. A separate window of this editor will pop-up any time you need to input something: initially selecting commits, rewording commit messages (whether for reword or squash commits), etc.

- 9,323
- 1
- 45
- 67
git gui
can be used to add files to the index when doing a rebase --interactive
(as mention in thegit rebase
man page, The GitHub rebase help page or in this git rebase interactive tip article), but not to perform the rebase
itself.
(unless, as you saw, you define the command yourself in the Tools section)

- 1,262,500
- 529
- 4,410
- 5,250