When I do git commit -a
, it opens the editor, in which the changes to be committed are commented out. I always uncomment these lines manually.
Is there a way to configure git
to include those lines by default?
When I do git commit -a
, it opens the editor, in which the changes to be committed are commented out. I always uncomment these lines manually.
Is there a way to configure git
to include those lines by default?
As already mentioned in the various comments, it is not a good idea to do that. A commit message should explain, why you did something - the what is already in the commit itself and can be checked via git show --name-status <commit>
.
Nevertheless, if you need this functionality, you can add this as a prepare-commit-msg-hook, which lives in .git/hooks/prepare-commit-msg
and might look like this:
#!/bin/bash
git diff --name-status -r >> $1
This will essentially give you a list of differences of the stage.