1

The default git commit message is :

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   modified:   file1
#   modified:   file2
#

That's fine for me. But by default, I would prefer to have some lines uncommented :

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
 On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)

    modified:   file1
    modified:   file2
#

so I don't have to uncomment them each time. Is it possible ?

Thanks

Dharman
  • 30,962
  • 25
  • 85
  • 135
user1286975
  • 13
  • 1
  • 3
  • 4
    Why do you want the list of modified files in the commit message? It is totally redundant. – Ben James Mar 22 '12 at 21:31
  • This is not a duplicate question. The poster specifically desires to include the list of modified files in the commit message, which the other question doesn't mention at all. – amcnabb Mar 23 '12 at 00:17

1 Answers1

2

This information is easy to generate. Don't include this information in the commit message because all it can do is get out of sync with the actual changes in the commit. Instead, make git generate the information you need later. For example, git log --name-status will show which files were modified. You can even set an alias in your .gitconfig to make such options default. This approach should give you all of the information you need while avoiding possible pitfalls and violations of git conventions.

amcnabb
  • 2,161
  • 1
  • 16
  • 24