0

As mentioned above, I am looking for something like this:

$ git commit -m "my first commit" --editor="vim"

that will allow me to one-off swap editor for a single run. Examples where this might be useful is when squashing lengthy histories or writing up messages for a feature commit.

user2167582
  • 5,986
  • 13
  • 64
  • 121

1 Answers1

1

You can override EDITOR environment variable just for one git execution:

EDITOR=nano git commit -a
olmstad
  • 686
  • 5
  • 9
  • This doesn't work for me, because I have a default editor configured globally in `~/.gitconfig`, and this command fails to override it. – abeboparebop Aug 02 '23 at 14:13