Reputation: 15967
Earlier in the week I decided to try and turn all my dot files into a git repo using symlink and I broke a lot of my dev set up. While I've restored what I can, I'm still having a few trailing issues that I'm unsure how to solve.
One example is when I run git commit (with no flags), it would normally pop up my vim with the typical items found in .gitmessage
:
50-character subject line
72-character wrapped longer description. This should answer:
- Why was this change necessary?
- How does it address the problem?
Are there any side effects?
Include a link to the ticket, if any.
I apparently got rid of that file because when I run git commit it shows:
So I got one of the other developers here to send me their .gitmessage file, I dropped it into my directory but now when I run git commit
vim just shows the normal vim start screen. I start to type and save and it complains about not having a filename
. I give it one and it doesn't seem to care or attach it to my git commit.
I'm sure I screwed up a number of git issues but I'm unsure where or how to fix this.
Thanks to Michael I've updated my commit.template
to point to the right file but alas I'm still not getting it right. Here's what it looks like:
Upvotes: 1
Views: 399
Reputation: 270677
A couple of configurations went missing and they aren't difficult to restore. The first is the commit.template
Git configuration. Once you have restored your ~/.gitmessage
file to its intended location, tell Git how to find it with:
git config --global commit.template $HOME/.gitmessage
Or add if you don't mind modifying your .gitconfig
directly, you can add:
[commit]
template = ~/.gitmessage
Then, based on your animation above, it appears that Git may be using different editor settings than Vim as you expect it to. This may be because the core.editor
configuration is unset and relying on your $EDITOR
environment variable. If you want it to use proper Vim (rather than something like vi compatibility), set the configuration:
git config --global core.editor vim
Or modify .gitconfig
[core]
editor = vim
This part might have been avoided if your $EDITOR
environment variable is set to vim
. I would recommend doing that anyway, so your preferred editor is always used when a running program calls for an editor. In your ~/.bashrc
you may add:
export EDITOR=vim
Upvotes: 1