3

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?

Dan Rosenstark
  • 68,471
  • 58
  • 283
  • 421

2 Answers2

5

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.

Tim Henigan
  • 60,452
  • 11
  • 85
  • 78
  • Cool, +1 and thanks for that, Tim. It could indeed be that it was left over from an earlier conflict, since I had this problem last time I merged, and I don't know how I resolved it :) – Dan Rosenstark Oct 05 '09 at 16:48
  • The `--ours` and `--theirs` are excellent tips. I obsessively read man pages to find options and still forget about those sometimes. – Cascabel Oct 05 '09 at 20:06
0

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250