Sunday 15 January 2012

branching and merging - Git merge with conflicts - which line was committed later -



branching and merging - Git merge with conflicts - which line was committed later -

when conflict arises during git merge, wonder line right 1 (which 1 modified last). example:

<<<<<<< head div.some-class ======= div.another-class >>>>>>> commit message doesn't give clue commit take #no clue

how can determine line modified last?

(we assume lastly commit correct, situation both branches modified more troublesome.)

if concerned dates, git show head should provide date , time of head. if need more detail specific lines, git blame <filename> should help find relevant commits, , can utilize git show <commit> find dates , times.

similarly, "some meaningless commit message", line should contain sha-1 hash can utilize git show <commit> find date , time of commit.

however, worth reiterating in cases, far more of import examine content of conflicting commits , create decision based on that.

edit after farther research: possible there merge strategy (git merge -s <strategy> [-x <strategy-option>]) merging automatically based on timestamp, have not been able find such alternative in documentation.

edit after more research: see here similar yet less contentious question might relate interests. may not want automated process, , solution there may not work situation, perhaps custom merge driver offered there help you.

git branching-and-merging

No comments:

Post a Comment