0

Can I safely squash commits where one of them is a merge commit? My commit history looks like this:

enter image description here

I'm wondering if there will be problems or conflicts when trying to merge this squashed branch into master. I haven't pushed my branch yet so it shouldn't affect other people's git history.

polmarex
  • 1,363
  • 5
  • 19
  • 35

1 Answers1

1

I'm wondering if there will be problems or conflicts when trying to merge this squashed branch into master.

That question is impossible to answer from here. There will or there won't. But whether there will be "problems or conflicts when trying to merge this branch into master" has nothing to do with whether the branch is squashed or not. It depends on what's been going on in master while you were out, as it were.

matt
  • 515,959
  • 87
  • 875
  • 1,141
  • Yeah, conflicts indeed are unrelated - my bad. I was just wondering if merge commits should stay in the git history or they are safe to be squashed like any other commit. So I guess they can be safely squashed? – polmarex Dec 09 '18 at 03:16
  • Squashing is just a way of reducing the commit history. Personally I think squashing is good and I do it all the time. I'm not sure what "safely" means here (since you are not attempting to rewrite the history already present in another repo — _that_ would be bad). – matt Dec 09 '18 at 03:21