2

i was just trying to merge two repositories. For some reason, the merging didn't go well and created a lot of conflicts. Most of them are due to the fact that i upadated a component in one version.

So what i would like to do is merge and wherever a conflict pops up, tell git to use the newer version. Otherwise it would take ages to merge this.

Is there a way to do this?

svick
  • 214,528
  • 47
  • 357
  • 477
Andresch Serj
  • 28,998
  • 14
  • 52
  • 96

2 Answers2

2

I'm afraid there's a problem with that "newer" concept: in Git, "tree objects" (which record names, sizes and hashes of blobs they reference) do not contain timestamps of those blobs. Hence there's a logical problem of deciding which of two (or more, for octopus merge) blobs which happen to map to the same filesystem name is newer than the others.

kostix
  • 43,267
  • 10
  • 69
  • 137
1

Could you not do a

git merge -s ours anotherbranch

?

Yanflea
  • 3,716
  • 1
  • 12
  • 14
  • 1
    hum... reading again your question, I assume it would'nt do the trick because "ours" does not have always the newest stuff, right ? :-/ – Yanflea May 11 '12 at 09:51
  • 1
    What about isolating the changes concerning the new version of your component in a new dedicated branch, merging it with "ours" option, and finally merging the rest the standard way ? – Yanflea May 11 '12 at 11:45