When I'm using Git on Mac and need to do a rebase, the Vim editor kicks in by default. I would prefer Nano – could someone please explain how to reconfigure Git to make it use Nano for rebase?
Asked
Active
Viewed 9.8k times
3 Answers
266
git config --global core.editor "nano"
More information here:
https://git-scm.com/book/en/Customizing-Git-Git-Configuration
Toto
- 19,304
sunnyrjuneja
- 2,776
- 1
- 15
- 4
36
If you want to use nano as your editor for all things command line, add this to your bash_profile:
export EDITOR=/usr/bin/nano
This is assuming you're using the system nano. If not, edit to suit where your nano lives (e.g. /usr/local/bin, /opt/local/bin)
Remember to source your bash_profile after setting this or open a new terminal window for the settings to work...
phildobbin
- 461
- 3
- 4
6
I just learned a moment ago that there (on OSX anyway) is a file at /Users/<USER_NAME>/.gitconfig
$ nano /Users/bob/.gitconfig
Then you should see something like this:
[user]
email = bob@sandwich.net
name = Bob Sandwich
[core]
editor = nano
[merge]
tool = vscode
[mergetool "vscode"]
cmd = "code --wait "
[diff]
tool = vscode
[difftool "vscode"]
cmd = "code --wait --diff "
After seeing that structure, you can intuitively understand something like (ie: core.editor):
git config --global core.editor "nano"
agm1984
- 179
- 1
- 4