0

I know that GitHub highly recommends to use messages BUT I work on semi-public projects with my brother and we are working in the same room so obviously we don't need any comments to our commitments. Are there any other options to completely disable commitment messages at least for the specific repository/project/file?

I found this command to make a single commitment: git commit -a --allow-empty-message -m "" and it works pretty well but I'm already tired of typing it every time.

mzjn
  • 48,958
  • 13
  • 128
  • 248
smbrine
  • 1
  • 2
  • 2
    A commit message is not just information for your current co-workers, but also one from your younger self to your older self in a year down the road. Therefore, you should not just put some dummy text into the message, but write down what your thinking was when you made a change, and in particulr ***WHY*** you made a change. Because that is the most important question you want to see answered when you look at the change again a year later. – j6t Feb 18 '23 at 08:17
  • If you don't care about tracking your code, why use Git? Just push your changes to DropBox or a local network drive or something. – CrazyChucky Mar 08 '23 at 12:19

1 Answers1

5

I'm not entirely sure why you would want to commit without a message every time since the whole idea of Git is to track code. You'll probably want to create an alias for the command to prevent you having to type it every time.

I haven't tested this, but something like:

git config --global alias.cm "commit -a --allow-empty-message -m ''"

then you would run git cm instead. See here for more information on aliases.

Liam McArthur
  • 1,033
  • 3
  • 18
  • 42
  • It seems more convenient but are there any other options to change the behavior of the blue button in the source control section? Or maybe a bind for this command? – smbrine Feb 18 '23 at 07:53
  • 3
    @smbrine What "blue button in the source control section"? You haven't mentioned any graphical tools anywhere on this page. – IMSoP Feb 18 '23 at 12:32
  • If you're talking about VSCode, you'd have to somehow amend the commit button functionality (if it's even possible). I don't use VSCode, so I wouldn't be sure, but this might help https://stackoverflow.com/a/73321308/2053918 – Liam McArthur Feb 18 '23 at 20:03
  • Yeah I apologize for not mentioning that I work in VS. The link you left is quite useful so I’ll try to figure it out and maybe leave a post about it. – smbrine Feb 19 '23 at 08:47