Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Post History
Rather that doing git commit --amend --date= every time you commit, you can coalesce commits at merge time using git merge --squash. That said, for non-trivial topic branches, it is usually valuab...
Answer
#4: Post edited
- Rather that doing `git commit --amend --date=` every time you commit, you can coalesce commits at merge time using `git merge --squash`.
That said, for non-trivial topic branches, it is usually valuable to retain the commits in the topic branch to figure out why a particular change was made. For instance, if you are developing a feature in a feature branch, you might also have some refactorings, or non-obvious bugfixes, that would be better described in a commit of their own.- In general, I find a detailed and truthful history more valuable than a pretty one: The purpose of history is not to look beautiful, but to be able to figure out why a certain change was made. Yes, unnecessary information may slow the inspection of history, but deleted necessary information will halt it.
- PS: You may have noticed that this answer does not mention commit dates. That's because they rarely matter in my experience: When inspecting history, I care about the "what" and "why", not usually the "when". And even when I care about the "when", it'll only be about the year, or the release, not the day. Therefore, the choice of commit frequency or squashing should not be affected by dating considerations.
- Rather that doing `git commit --amend --date=` every time you commit, you can coalesce commits at merge time using `git merge --squash`.
- That said, for non-trivial topic branches, it is usually valuable to retain the commits in the topic branch to figure out why a particular change was made. For instance, if you are developing a feature in a feature branch, this might require some refactorings, or non-obvious bugfixes, that would be better described in a commit of their own.
- In general, I find a detailed and truthful history more valuable than a pretty one: The purpose of history is not to look beautiful, but to be able to figure out why a certain change was made. Yes, unnecessary information may slow the inspection of history, but deleted necessary information will halt it.
- PS: You may have noticed that this answer does not mention commit dates. That's because they rarely matter in my experience: When inspecting history, I care about the "what" and "why", not usually the "when". And even when I care about the "when", it'll only be about the year, or the release, not the day. Therefore, the choice of commit frequency or squashing should not be affected by dating considerations.
#1: Initial revision
Rather that doing `git commit --amend --date=` every time you commit, you can coalesce commits at merge time using `git merge --squash`. That said, for non-trivial topic branches, it is usually valuable to retain the commits in the topic branch to figure out why a particular change was made. For instance, if you are developing a feature in a feature branch, you might also have some refactorings, or non-obvious bugfixes, that would be better described in a commit of their own. In general, I find a detailed and truthful history more valuable than a pretty one: The purpose of history is not to look beautiful, but to be able to figure out why a certain change was made. Yes, unnecessary information may slow the inspection of history, but deleted necessary information is worse. PS: You may have noticed that this answer does not mention commit dates. That's because they rarely matter in my experience: When inspecting history, I care about the "what" and "why", not usually the "when". And even when I care about the "when", it'll only be about the year, or the release, not the day.