2

is there a best approach for resolving merge conflicts in notes branch(git-notes) of git. The usual practice of doing a

git pull --rebase origin refs/notes/commits:refs/notes/commits    

does not work. The approach which i tried was

git checkout refs/notes/commits
git fetch origin refs/notes/commits:refs/notes/origin/commits 
git merge FETCH_HEAD 
git update-ref refs/notes/commits 

but it creates merge conflicts and disrupts the history. Please help. Immediate help would be appreciated. Thanks

Iowa
  • 2,171
  • 4
  • 22
  • 31
  • 1
    Yet, the git merge approach seems the recommended approach... See http://stackoverflow.com/a/16269354/6309 and the script https://github.com/aspiers/git-config/blob/master/bin/git-rnotes – VonC Sep 05 '13 at 08:59
  • the command git notes merge -v origin/commits is not working – Iowa Sep 05 '13 at 09:18
  • What is the error message? Or is it only because it generates conflicts? – VonC Sep 05 '13 at 09:24
  • "git notes merge -v origin/commits" does not seem to merge the non-conflicted files. For example, if there is a conflict in file A, then file A gets merged, but file B does not get merged.. :( pain of a process.. – Iowa Sep 05 '13 at 09:30
  • 1
    Interesting, that is not what http://stackoverflow.com/a/16269354/6309 is saying: "If there are conflicts, it will now tell you to edit `.git/NOTES_MERGE_WORKTREE` and then commit the result via `git notes merge --commit`" – VonC Sep 05 '13 at 09:33
  • thanks, was probably a little impatient, but was able to sort it out.. :) – Iowa Sep 05 '13 at 09:48
  • Great. I have added an answer to summarize this conclusion. – VonC Sep 05 '13 at 10:15

1 Answers1

1

For example, if there is a conflict in file A, then file A gets merged, but file B does not get merged

As mentioned in "Merging git notes when there are merge conflicts in them"

git fetch origin refs/notes/commits:refs/notes/origin/commits
git notes merge -v origin/commits

If there are conflicts, it will now tell you to edit .git/NOTES_MERGE_WORKTREE and then commit the result via git notes merge --commit, or abort the merge with git notes merge --abort.

So B should get merged after the git notes merge --commit.

Note: Git 2.6 (Q3/Q4 2015) will add git notes merge strategies.

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