Thread with 12 posts
jump to expanded posta thing that really irks me about git: the āauthor dateā in commits. imho, if you make non-trivial changes to a commit when amending it, you should update that date; and if you squash several commits together, you should use the date of the latest one. neither is the defaultā¦
git commit --amend defaults to not changing the author date. thatās reasonable for minor changes, but in an environment where people work with commits rather than branches (e.g. Gerrit), this means commit dates that are days, weeks or months earlier than most of the changesā¦
you can use --reset-author when editing a commit, but not many people seem to know of that.
meanwhile using git merge --squash to do a squash merge of someone elseās work makes you the author now, and makes the date the current time. I donāt like that either.
for amending, I feel like changing the default behaviour is never going to happen. on the other hand, maybe Iāll eventually submit a patch to git to add an alternative squash modeā¦
in the meantime, I am using a very particular, manual process for all my git merges.
@hikari when I am elected president, āamend will retain previous versions of the commit by default, and squash will be non-destructive.
@richardstephens ooh, how would you do that?
@hikari Instead of actually squashing, generate an empty commit with metadata that indicates "treat the past 7 commits as one squashed commit". Even better, bisect, could know to jump between only squashed commits.
@hikari You could also make an "amended" commit actually a branch that's hidden from most of the UI. Both of these solutions would be backwards compatible too, although I freely admit to not having thought through all the implications.
@richardstephens honestly it sounds to me like what you want are actual merges
@saagar @hikari where Iām coming from is that thereās often a trade off between āclean history with messy intermediate states discardedā and āall intermediate states kept but history is an unintelligible messā. I think it would be neat if we could have tools that would only surface a clean curated view of history by default but also had the more detailed view available in the rare case itās needed.