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
Leave a Reply