Reputation: 1139
Say you made a commit that you thought fixed a bug. All was good for a while until you found that it broke something else and made a new commit fixing that. Or you discovered that the original fix was incomplete but you already pushed it and there are other commits in between.
I usually just include something like "fixes a bug introduced in commit XXXXXXXX" in commit message.
But I was wondering if there is a conventional format for this kind of thing that can be possibly recognized by third party git tools since AFAIK git doesn't support it natively.
Edit:
Closest that I could google so far is Gerrit with its "Change-Id" feature.
Upvotes: 0
Views: 76
Reputation: 33626
Refer to commits by their SHA1. Usually tools (eg. Github, Bitbucket, Gitlab) parse it and link to the corresponding commit.
Hint: Usually you don't have to include the whole hash; the first 6 characters should suffice.
An example commit is here.
P.S. You may also wanna check out a Git Style Guide.
Upvotes: 1
Reputation: 3692
Solution that we use in our company looks like this:
We are not storing relations between tasks/commits in version control system, but we storing it in a task tracker.
Usually we track every feature/bug in task tracker as a ticket. Each ticket has name - prefix and number (like this: ProjectName-56). When you start working on that ticket, you create separate branch with name same as ticket.
Also, each commit message in that branch starts with ticket name (it helps in future, when you are using git blame
to understand which ticket related to that code line).
All relations between tasks we saving in issue tracker, also you can provide some useful commentaries for other developers for future.
So, in your case you can create bug in task tracker and write commentary that the bug has appeared after ProjectName-AnotherTaskNumber were pushed.
We are using JIRA as task tracker and bit bucket as repository and bit bucket automatically creates links for every ProjectName-xx text (from commit message or branch) for ticket on a JIRA and vice versa. I think github has same integration for github issue tracker.
Upvotes: 1