Skip to content

Instantly share code, notes, and snippets.

@f3r
Last active October 10, 2015 04:31
Show Gist options
  • Save f3r/4c95459862ac34bc7143 to your computer and use it in GitHub Desktop.
Save f3r/4c95459862ac34bc7143 to your computer and use it in GitHub Desktop.
Sublime Text 3 Configuration for git

Everybody has terrible commit messages in some point in their life. Sometimes every single day.

Zac Holman

Making a better Git commit

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

How?

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.

Why?

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"

Useful Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment