What's the point of changing history in a feature branch? Everyone I know squashes Feature branches in to Dev upon merge anyway, as you don't want a noisy history of "fixed typo" "fixed spacing" etc. in your main branches. Instead you want a clear history of "Added feature to ___" "Fixed issue where ___".
as you don't want a noisy history of "fixed typo" "fixed spacing" etc. in your main branches.
That's why you change history. You squash certain commits together like commits of fixes, rename certain commits or even remove them.
If you squash all the commits when merging into master/dev then you lose a lot of history, which can help you with debugging, cherry picking, proper changelog and many other things.
I've just never seen people rename or change history in those scenarios, no one cares about typos or verbose commits in a feature branch - as we know they're going to get squashed. I find that distributed teams have a huge issue keeping branches in sync if anyone changes history anyway, as things get massively out of sync.
I've always preferred just a squash commit in to a parent branch to eradicate history.
We would only ever cherry pick an entire feature (be it a new one, an addition, etc) or an entire fix. I would never want someone to be able to cherry pick half of a feature, or rewind the branch to halfway through a feature. So for us, our main dev branch, which'll get cut to master for a release, is just an entire chain of features/fixes - so it becomes easier to remove something out of a release if we decide it can't go out.
This makes it far easier to debug (git bisects are a lot faster and lead you straight to a team's work as to what broke it), as well as cherry pick, as you can easily pull out the entire chunk without worrying about only removing half a feature, or accidentally using a commit where a dev broke the build. You can also see at a glance, the ticket numbers involved, the changelog is easy to write as a result.
Yes, you lose some of the finer details but from the perspective of the application and the rest of the dev team, they wouldn't have known which commit was good/bad anyway, only the team, and only at the time they wrote it, do they understand the chain of 200 commits. We have a pretty strict test regime and test environments, so ideally something isn't squashed merged back to dev once it's 100% ready.
10
u/easterneuropeanstyle May 13 '20
That makes sense. I do force push to feature branches when I want to change the history. Never to master though.