Hacker News new | ask | show | jobs
by igrunert 561 days ago
There are a handful of git features which work significantly better with a clean history on main. If `git blame` points at a well crafted commit, it can help bring additional context to the line in question. In addition `git log -S<string>` can be used to find when code was introduced.

Both of these features aren't very useful when they point at a "wip" or similar commit message.

By all means push lots of little commits to your branch while you're figuring stuff out, but squash and rewrite history into logical commits (usually just one) before landing the change on main.

1 comments

I learned about the --first-parent flag of git blame recently. It allows git blame to work well in repos that use merge commits.
There is also -r, which leaves merge commits and lets you move them around.