开发者

Reading GIT Merge Markers

Sorry, this is a very simple question. What does this merge marker mean in GIT

>>>>>>> next-release:db/schema.rb
开发者_运维问答

when it's got no accompanying?

=======

Also, is there some way to tell GIT to just choose one version over another?


To tell Git to choose one version over another (of an unmerged path), you can use one of :

  • git checkout --ours -- path/to/file
  • git checkout --theirs -- path/to/file

See the git checkout man page for details.

Regarding the merge marker; I have never seen a ">>>>" added without a matching "====" and "<<<<". Are you sure this wasn't left over from an attempt to manually resolve the conflict?

The tag next-release:db/schema.rb simply indicates that the file "db/schema.rb" is on the "next-release" branch.


As mentioned in this thread, be careful if you got a merge conflict during a rebase.

its confusing when resolving a merge conflict.
In the past I could use:

git checkout --theirs -- <filename>

to checkout theirs version but now I have to do:

git checkout --ours -- <filename>

to checkout theirs version.

Check "Why is the meaning of “ours” and “theirs” reversed" to see why the options are reversed when rebasing.

And as mentioned in "How can I discard remote changes and mark a file as “resolved”?", don't forget to use the '--' between the checkout options and the filename.

If you don't do this, and the filename happens to match the name of a branch or tag, Git will think that you want to check that revision out, instead of checking that filename out, and so use the first form of the checkout command.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜