• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (deprecated)
You are here: Home / Dev Tips / Use a Different Editor for Git Interactive Rebase

Use a Different Editor for Git Interactive Rebase

Last updated on December 9, 2023 by Sal Ferrarello

I’m a big proponent of changing your Git editor, so whenever Git opens an editor, it is your editor of choice. In Git version 2.40, released in 2023, an additional configuration value was added (sequence.editor) to define a different editor specifically for Git Interactive Rebase (not any other time).

Git Interactive Rebase

When you run git rebase with the --interactive (or the short version -i), you get a list of the commits set to pick.

e.g. if you run git rebase --interactive HEAD~5, you’ll get something like the following in your default editor.

pick 7901e74 Add support for - to can-ff-merge alias
pick eada784 Add defaultRemote "origin"
pick dcb8c11 Set tag.sort to sort by version name in desc order
pick 126b1fc Set branch.sort to show newest branches first
pick 5263b82 Add alias "git dgone" to branches gone from remote

# Rebase be43d0a..5263b82 onto be43d0a (5 commands)

The idea here is you go through and modify one of more of the pick values to something else and then save to continue the rebase.

Changing the Editor for Interactive Rebase

You can configure Git to use a different editor for this interactive rebase screen. For example, perhaps you like writing your commit messages in Vim but when doing an interactive rebase you would really like to use VS Code because you have the GitLens plugin installed.

In this case you can set the following in your Global Git Configuration file. Now your editor for writing commits will remain unchanged, however when you do an interactive rebase it loads the sequence page where you modify the pick values in VS Code.

[sequence]
    editor = code --wait
Sal Ferrarello
Sal Ferrarello (@salcode)
Sal is a PHP and JavaScript developer with a focus on the WordPress platform. He is a conference speaker with a background including Piano Player, Radio DJ, Magician/Juggler, Beach Photographer, and High School Math Teacher. Sal can be found professionally at WebDevStudios, where he works as a principal engineer.

Filed Under: Computing, Dev Tips Tagged With: Git, gitconfig

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2026 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in