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.
链接地址: http://www.djcxy.com/p/41692.html上一篇: 如何同步两个git
下一篇: 阅读GIT合并标记