Skip to contentSkip to conversation

Git feature request: mark a commit as minor

DISCUSSION Felipe Micaroni Lalli 4 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

Thank you.

#1 lore raw
Quoted 9 lines · Felipe Micaroni Lalli

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

I can see your problem and implement your suggest is a solution that would work. However since this is a common problem, git already has a solution, that is the interactive rebase.

You can read a discussion about when to use merge and rebase here:
http://www.mail-archive.com/[email protected]/msg39091.html

This work method make the "minor" commits to go away. There shouldn't be any minor, or "fixup" commits in your history (of course there's exception).

Minor things should be caught in your code review process and then fixed, rebased and the merged again.

Or do I miss a usecase here?

Signature · 5 lines
Fredrik Gustafsson

phone: +46 733-608274
e-mail: [email protected]
website: http://www.iveqy.com
#2 lore raw

You are right. It could be useful to fix old commits (already pushed) but it could encourage bad practices. Minor changes should be avoided, it is an exception, not a rule.

Thank you Fredrik.

Quoted 27 lines · Fredrik Gustafsson
Quoted 9 lines · Felipe Micaroni Lalli

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

I can see your problem and implement your suggest is a solution that would work. However since this is a common problem, git already has a solution, that is the interactive rebase.

You can read a discussion about when to use merge and rebase here:
http://www.mail-archive.com/[email protected]/msg39091.html

This work method make the "minor" commits to go away. There shouldn't be any minor, or "fixup" commits in your history (of course there's exception).

Minor things should be caught in your code review process and then fixed, rebased and the merged again.

Or do I miss a usecase here?

#3 lore raw
In reply to Felipe Micaroni Lalli
Quoted 11 lines · Felipe Micaroni Lalli

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

This should just be part of the commit message log, generally projects use something like TRIVIAL in the patch subject or similar. You could also standardize for your project(s) what would be considered a minor change. The issue is that not everyone considers these changes as "minor". You should be able to use a combination of the --grep option in log to search for all commits who don't contain that string in the right format.

Regards,
Jake

#4 lore raw
Quoted 14 lines · Jacob Keller
Quoted 11 lines · Felipe Micaroni Lalli

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

Quoted 7 lines

This should just be part of the commit message log, generally projects use something like TRIVIAL in the patch subject or similar. You could also standardize for your project(s) what would be considered a minor change. The issue is that not everyone considers these changes as "minor". You should be able to use a combination of the --grep option in log to search for all commits who don't contain that string in the right format.

Could also be a good use for notes, since you might want to add this markup after the fact.

Signature · 1 line
Mikael Magnusson
#5 lore raw

Thank you Jacob.

Actually we already use the keyword MINOR for that, exactly as you said.

The suggestion was made because I think it is a common behavior and it would be nice to be a meta info to standardize this (today each team adopt a different pattern for that - you used "TRIVIAL" e.g.). Nice things could be done with this meta-info. It could be totally ignored (current git operation) or it could be used to filter, to sort, to group commits, to show the log pretty etc.

Quoted 1 line

The issue is that not everyone considers these changes as "minor".

I understand this issue, I know it is subjective. But if someone don't want to make the distinction just don't use the argument --hide-minor for example.

Quoted 26 lines · Mikael Magnusson
Quoted 14 lines · Jacob Keller
Quoted 11 lines · Felipe Micaroni Lalli

A minor change (also called "cosmetic") usually is a typo fix, doc improvement, a little code refactoring that don't change the behavior etc.

In Wikipedia we can mark an edition as "minor".

It would be nice to have an argument like "--minor" in git-commit to mark the commit as minor. Also, filter in git-log (like --hide-minor) to hide the minor changes. The git-log could be optimized to show minor commits more discreetly.

Quoted 7 lines

This should just be part of the commit message log, generally projects use something like TRIVIAL in the patch subject or similar. You could also standardize for your project(s) what would be considered a minor change. The issue is that not everyone considers these changes as "minor". You should be able to use a combination of the --grep option in log to search for all commits who don't contain that string in the right format.

Could also be a good use for notes, since you might want to add this markup after the fact.

#6 lore raw
Quoted 9 lines · Felipe Micaroni Lalli

Actually we already use the keyword MINOR for that, exactly as you said.

The suggestion was made because I think it is a common behavior and it would be nice to be a meta info to standardize this (today each team adopt a different pattern for that - you used "TRIVIAL" e.g.). Nice things could be done with this meta-info. It could be totally ignored (current git operation) or it could be used to filter, to sort, to group commits, to show the log pretty etc.

Quoted 7 lines
Quoted 1 line

The issue is that not everyone considers these changes as "minor".

I understand this issue, I know it is subjective. But if someone don't want to make the distinction just don't use the argument --hide-minor for example.

I think use of git-notes is probably the best way. Not sure how/if you can implement filtering on that, but I don't personally think something like this belongs in core git.

Regards,
Jake