Thursday, April 7, 2016

Change Editor for Git Commit Messages

Git is a very powerful tool especially when used from a console. Obviously committing changes is a pretty common task which includes editing commit messages. If a message is short it is easy to specify it via -m option:
$ git commit -m "my commit message"
But what if you have a long list of changes and you need a descriptive well-formatted commit message? It would be cool to write it in your favorite text editor, wouldn't it? Is there a way to tell Git which editor to use? Yes, it is. According to the docs for git-commit:

"The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order)."

I'm a Vim fan and I stick to the core.editor configuration variable. So, here is my preferred way to configure commit message editor:
$ git config --global core.editor "vim"
Now I can omit -m option and enjoy editing commit messages in Vim :)

1 comment:

  1. Indeed, It is astonishing knowledge for a man to appreciate the houseboat encounter and should not be missed. It is a heaven in the "Divine beings claim Country". Allepy called the "Venice of East" is the place that is known for backwater and tidal ponds in kerala is acclaimed for its regular magnificence. Tasty kerala sustenance furnished with in the houseboat is an extra as well. Inns at shoddy rates are there around the vessel wharf, where individuals can have simple sustenance including different fish fries alongside custard .

    ref : thesis writing service