So merging master with S on one side and feature2 with 1–5 on the other will conflict. As far as git is concerned, there is no relation between S and 1–5. As you can see, the common ancestor of F and S is A. So let's look at your history: F feature2Ī is the common ancestor, 1–5 the original feature branch, F the new feature branch, and S the squashed commit that contains the same changes as 1–5. Merging tries to combine the changes of two commit's histories (branches) starting from a common ancestor commit. But as existing commits are immutable, this should be understood as “writing an alternative history.” Recording a new commit with the same changes as an existing commit is called history rewriting. Rebasing is similar, but doesn't combine commits. Instead, it records a new commit with the changes from multiple other commits. So my question is, is there any way to get around this (other than just never basing one feature branch off another, which limits my workflow) or does squash merging just break git's merging algorithm? This is because git doesn't see the original commits that the second branch was based off of, it just sees the one big squash merge and so in order to merge the second branch in to master it tries to replay all the first branch's commits in top of the squash merge, causing lots of conflicts. However, when it comes time to create a pull request for me second branch, the first branch has already been merged into master and because it's been done as a squash merge, git flags up a bunch of conflicts. I can create a branch for that backlog item and base it on the first branch. The trouble is, what if I do some changes in one branch for one backlog item, then immediately want to start doing changes in another branch for another backlog item, and those changes depend on the first branch's set of changes? Microsoft's "recommended" way of merging a branch is to do a "squash merge", meaning that all commits for that branch get squashed into one new commit incorporating all of the changes. I'm currently working for a company that uses VSTS for managing git code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |