Wednesday, January 14, 2015

git

$ git commit -m "commit_message"

Yes I know you can do commit messages right in the command line but I like to be more specific about them. 

So I just type in:
$ git commit

and a text editor pops up for the commit.
I like to un-comment the files being added, changed and deleted. I also like to write a good description. Unless I am in a hurry or feeling particularly lazy this is how I do it.

I think it is the version of Ubuntu I am using or some other reason I am unsure of but when I go to commit my projects to git and pop open the window it opens in the nano editor as default.
I don't like it. I prefer vim. 

So instead of declaring the change in the terminal every time I go to commit I changed the .git/config file.

I did this through the terminal using the ultimate git guide. 

$ git config --global core.editor vim


1 comment:

  1. Great tip about not using the -m. It gives you the transition of development, to writing a great commit message. Using the -v option will include your patches as well, so that you can make sure that what you are committing is related.

    About your config initially, it is possible that your environment variable for $EDITOR is set to nano. You can set that environment variable to another editor. Of course it is good to know that you can change this for just your git use.

    ReplyDelete