There are two branches master
and feature
.
The development goes in feature
branch and there multiple commits done in that branch, but in between them there were several merges with master
branch, so the log for feature branch is for example something like:
feature commit 1
master commit 1
feature commit 2
master commit 2
feature commit 3
Is it safe to squash all these commits into one feature commit 1
?
Are there any problems that I could come across when merging feature
branch into master
?
Is it safe to squash all these commits into one feature commit 1 ?
No, it's not safe to do so
Are there any problems that I could come across when merging feature branch into master ?
As I understand the problem, in that case you are changing the master branch history and basically breaking it for everyone.
When you squash your feature
branch for the commits starting from your first one to your last one, you will also squash all master commits, in addition to your two feature commits - even master
commits that changed files you did not touch.
So your squashed commit will have a lot of changed files that you didn't change at all. When merging back to master branch, even though the content of those files didn't change, the commit hash has changed, so people that are working with you in this repo will have all kinds of conflicts later on.