Labelling commits to group them in Git
Is there a way/common practice to label and group commits in Git? I understand that the de facto practice, for example, is to reference issue numbers preceded by an hash and people preceded by an at-sign (such as
Fixed #23 or
@userName), and applications like BitBucket or Github already parse these correctly.
I would like a way to group a certain type of commit so that I can easily reference them later. For example, sometimes I implement certain changes, but I know I’m going to modify them sooner or later: so I usually write
for the time being in the commit message, so it is easier for me to just search the logs for such commits.
So, is there a way, common/best practice that is used in these cases? Or even a git tool I am not aware of?
One Solution collect form web for “Labelling commits to group them in Git”
You could use
post-commit hooks in your repository to achieve this effect. Briefly:
- You commit with message, containing special label (example:
post-commithook parsing your commit message and detects this
@fancy_label(and other labels)
post-commithook after this adds this commit to list of commits for each label and saves it to persistent storage (to plain files, or even database)
This persistent storage could be personal (non-committable in folder .git) or committable (included in project).
And you need to make git aliases to make searching and listing of this commits by their respective labels easier.