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
  • 236,525
  • 50
  • 385
  • 514
Andresch Serj
  • 35,217
  • 15
  • 59
  • 101

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
  • 51,517
  • 14
  • 93
  • 176
1

Could you not do a

git merge -s ours anotherbranch

?

Yanflea
  • 3,876
  • 1
  • 14
  • 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