开发者

Git merge mangles source files

I've run into some strange behavior with git and I was wondering if anyone has any experience with it. I have two branches, stable and master, that I have m开发者_StackOverflow社区erged after resolving conflicts. Unfortunately, the master branch (which should now reflect all of the changes in stable) will not compile due to the insertion of markup by git. It looks something like this:

>>>>>>> stable
=======

Duplicate code will usually appear between the markups, presumably to differentiate between code in the different branches.

Ideas? Thoughts? Doinitwrong?


Correct, that mangling is git's way of showing you what the conflicts are. They are called 'conflict markers'. When resolving conflicts you need to remove those extra characters as you go along and pick the correct side to keep (old vs new code).

Once you have resolved all the conflicts and removed the extra characters/lines then add and commit those changes to finish the merging of the branches.

Here is tutorial about basic branching and merging and another right from the git manual on resolving conflicts.


Rather than resolving merge conflicts by hand, look at using git-mergetool with meld.

Git merge mangles source files

See also

  • Painless Merge Conflict Resolution in Git
  • What's the best visual merge tool for git?


That is How conflicts are presented by Git, or for that matter any other Source Version control system like CVS, SVN, Perforce, Mercurial, Bazaar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜