Skip to content

Instantly share code, notes, and snippets.

@zakkak
Forked from adeekshith/.git-commit-template.txt
Last active March 21, 2024 14:26
Show Gist options
  • Save zakkak/7e06725ebd1336bfebebe254de3de825 to your computer and use it in GitHub Desktop.
Save zakkak/7e06725ebd1336bfebebe254de3de825 to your computer and use it in GitHub Desktop.
This commit message template that helps you write great commit messages and enforce it across your team.
# [<tag>] (If applied, this commit will...) <subject> (Max 72 char)
# |<---- Preferably using up to 50 chars --->|<------------------->|
# Example:
# [feat] Implement automated commit messages
# (Optional) Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# (Optional) Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
# --- COMMIT END ---
# Tag can be
# feat (new feature)
# fix (bug fix)
# refactor (refactoring code)
# style (formatting, missing semi colons, etc; no code change)
# doc (changes to documentation)
# test (adding or refactoring tests; no production code change)
# version (version bump/new release; no production code change)
# jsrXXX (Patches related to the implementation of jsrXXX, where XXX the JSR number)
# jdkX (Patches related to supporting jdkX as the host VM, where X the JDK version)
# dbg (Changes in debugging code/frameworks; no production code change)
# license (Edits regarding licensing; no production code change)
# hack (Temporary fix to make things move forward; please avoid it)
# WIP (Work In Progress; for intermediate commits to keep patches reasonably sized)
# defaults (changes default options)
#
# Note: Multiple tags can be combined, e.g. [fix][jsr292] Fix issue X with methodhandles
# --------------------
# Remember to:
# * Capitalize the subject line
# * Use the imperative mood in the subject line
# * Do not end the subject line with a period
# * Separate subject from body with a blank line
# * Use the body to explain what and why vs. how
# * Can use multiple lines with "-" or "*" for bullet points in body
# --------------------
@eothein
Copy link

eothein commented Feb 20, 2019

Using this template a lot!

@YenHub
Copy link

YenHub commented Mar 28, 2019

Agreed, very awesome work! Thanks :D

@SreeChandan
Copy link

Hey I'm a noobie. Is there a way to make this template be used only on certain repositories? I don't it to be used globally. Tnx

@Harrisonkamau
Copy link

@SreeChandan Easy!
Inside your working folder:
git config --local commit.template PATH_TO_YOUR_COMMIT_TEMPLATE

@PsCustomObject
Copy link

Simply awesome!

Using this template in my workflows and simply loving it. Many many thanks from a lazy dev who googled for a commit template ;-)

@Harrisonkamau
Copy link

I'd rather see it as a smart way to standardize your commit messages across applications as opposed to being a lazy dev 😂

@zakkak
Copy link
Author

zakkak commented Aug 13, 2019

I think the lazy part goes to not creating a template from scratch but getting one readily available. In any case, you did your job faster, so being "lazy" paid of ;)

@PsCustomObject
Copy link

I'd rather see it as a smart way to standardize your commit messages across applications as opposed to being a lazy dev 😂

Ahahah yes indeed a way to look at it ;-)

On a more serious note that's exactly the reason for which I've downloaded the template and pushing my colleagues to do the same, that will be the hard part.

@PsCustomObject
Copy link

PsCustomObject commented Aug 13, 2019

I think the lazy part goes to not creating a template from scratch but getting one readily available.

This

In any case, you did your job faster, so being "lazy" paid of ;)

Working smarter rather than harder ;-)

Agian thanks for it!

@zakkak
Copy link
Author

zakkak commented Aug 13, 2019

Well, I just forked it from https://gist.github.com/adeekshith/cd4c95a064977cdc6c50 and tweaked it to my needs so credits go to the original authors ;)

@DenisVerkhoturov
Copy link

Stumbled upon this gist trying to find a way to have github use the same git-hooks script to validate commit messages, and just couldn't keep silent about that it is almost entirely identical to the Udacity Git Commit Message Style Guide. Sorry for doing that=)

@zakkak
Copy link
Author

zakkak commented Feb 20, 2020

Stumbled upon this gist trying to find a way to have github use the same git-hooks script to validate commit messages, and just couldn't keep silent about that it is almost entirely identical to the Udacity Git Commit Message Style Guide. Sorry for doing that=)

Hi @DenisVerkhoturov,

I don't understand what's the purpose of your comment.
Are you implying that Udacity should be credited?
Are you implying that Udacity should credit this gist (or the original)?
Did you just want to point out/highlight that this template conforms to Udacity's style guide for git commits?

@DenisVerkhoturov
Copy link

Easy, tiger, no need to be that irritated. I just wanted to point out that there is another variation that is almost the same out there. I wasn't making any claims=)

It's just that at some point you came across a style guide and decided to tweak it, instead of trying to search for a better variant that the community already had come up with (https://github.com/udacity/git-styleguide/commits/gh-pages/index.html). And I need to mention that I've never worked for Udacity or using it as a learning platform, I don't even like them. But it's worth mentioning that it is easier to live in a world that has no "duplicated code".

I sincerely apologize if my comment offended you in some way. I believe you can delete my comments if you feel like it.

@zakkak
Copy link
Author

zakkak commented Feb 21, 2020

Easy, tiger, no need to be that irritated. I just wanted to point out that there is another variation that is almost the same out there. I wasn't making any claims=)

As I said I did not understand the purpose of the comment so I wanted you to clarify. Thanks for that.

It's just that at some point you came across a style guide and decided to tweak it,

You are right at some point I came across this gist which had a template I could use as is. That template however was not exactly what I needed, so I forked it and tweaked it to my needs.

instead of trying to search for a better variant that the community already had come up with (https://github.com/udacity/git-styleguide/commits/gh-pages/index.html).

  1. I did search and I did find a number of different styles and templates and I chose this one because it fitted my needs.
  2. I don't see how Udacity's version is a better variant. This is subjective.

And I need to mention that I've never worked for Udacity or using it as a learning platform, I don't even like them. But it's worth mentioning that it is easier to live in a world that has no "duplicated code".

Udacity provides a web page with text describing how a good git commit message should look like and gives a commit example at the end. There is no code provided, there is no git template provided, thus I don't see where the "duplicated code" comes from, nor how I would benefit.

If you trace the origin of this gist you will find yourself here, only to find out that the original version of this script was indeed almost identical to Udacity's style guide. You will also find out that it was first created on 2015-02-12 (while Udacity's style guide first appeared on github on 2015-07-22) and that it mentions:

# For a full example of how to write a good commit message, check out
# https://github.com/sparkbox/how_to/tree/master/style/git

which implies that it was on its own inspired by some other work. The link is no longer available but I suspect it pointed to this.

To sum up, I have no idea who came up with this style guide originally (I guess as most things it started by someone and got improved over time), but I am happy there are "duplicates" of it and that we are free to create more "duplicates" that better fit our needs.
For more standardized commit messages have a look at conventional commits.
Also I believe that one of the greatest things in free and open-source software (and culture) is that you are free to tweak things to your needs/liking and there is no need for everyone to agree on a single implementation.

I sincerely apologize if my comment offended you in some way. I believe you can delete my comments if you feel like it.

It was just not clear to me what you were trying to achieve with that comment, so I wanted to make sure I understand and act accordingly. There is no need to apologize, just try to better convey the reason behind a comment. There is also no reason for deleting any comments from a discussion.

@DenisVerkhoturov
Copy link

Well, that is a good discussion. Thank you for pointing on conventionalcommits, I didn't know these guys=)

@Jonathanlight
Copy link

Well, Super template.

@amacedom
Copy link

Thanks for sharing!

@stapetro
Copy link

Thank you for sharing. I also incorporated it in my projects.

@arpitBhalla
Copy link

Thanks a lot🙂

@josueal1
Copy link

josueal1 commented Jun 1, 2020

Will this commit template also be reflected on the Github Desktop app? Any insights appreciated, thanks in advance.

@zakkak
Copy link
Author

zakkak commented Jun 1, 2020

@josueal1 I don't know about that. I am not using the Github Desktop app. If you give it a try let us know :)

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