Everybody has terrible commit messages in some point in their life. Sometimes every single day.
Try to limit using the -m
commit flag. git commit -m "A crappy commit message"
and use git commit
with no flags.
If using the simpler git commit
command it should open up sublime text, where you can construct a better commit by following some of these simple steps.
- The first line should be a short summary: This is the title of your commit and should be less than 50 characters. Referencing the bug number or the main accomplishment of the change.
e.g “Fixes issue #8976”.
-
Then a line break. Yeah, an empty line :p
-
Followed by a longer detailed description about the things that changed. This section is a really good place to explain what and why. You could cover statistics, performance wins, roadblocks, etc. The text should be wrapped at 72 characters.
Source: A better git commit
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
echo "export EDITOR='subl -w'" >> ~/.zshrc
Make sure you check your path for
Sublime Text.app/Contents/SharedSupport/bin/subl
is correct!
Now you when you commit, it will open a new Sublime Text and wait for you to save & close the file to actually commit the files.
The advantage is that this way you can add multiple lines in a commit message, rather than the one-liner you can supply with git commit -m "one-line-commit-message"