Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Because it becomes more compact. Most of the time git commits are things that don’t make sense to have at a more macro level. Squashing into a single commit that represents a coherent improvement, particularly for large projects, is the best way to read its history.


I prefer a small branch with many individual commits (cleaned from fixups or not) and a merge with main branch which adds the whole feature. Then you can have two levels of reading.


Doesn't this still put all the commits on the main branch?


You can keep the branch commits for detailed history, and look only at merge commits the when you don't need details:

     git log --first-parent -m
This will show a linear history of merges, treating the merged code as being added in the merge commit. You can add -p to see the diffs.


No you commit in feature branches then merge to main branch.


Do you then keep the branch around forever?


The branch history is preserved in the commit graph of the main branch, so you don't need to keep the feature branch.


But then does it matter at all that the date of the comment was the day where you committed the todo, or two days after when you squashed it ?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: