Advertisement
LemmingAvalanche

Demonstration for https://stackoverflow.com/questions/18736435/git-query-regarding-merging-notes-ref

May 9th, 2023
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. cd /tmp
  2. dir=$(mktemp -d)
  3. cd $dir
  4. git init
  5. git commit --allow-empty -mInit
  6. git commit --allow-empty -ma
  7. git commit --allow-empty -mb
  8. git commit --allow-empty -mc
  9. cd ..
  10. dir_remote=$(mktemp -d)
  11. cd $dir_remote
  12. git init
  13. git config receive.denyCurrentBranch ignore
  14. cd $dir
  15. git remote add origin $dir_remote
  16. git push origin main
  17. # Two notes in the “local” repo
  18. git notes add -mc
  19. git notes add -mb @~
  20. # And one note in the “remote” repo
  21. cd $dir_remote
  22. git notes add -ma @~~
  23. cd $dir
  24. git fetch origin refs/notes/commits:refs/notes/origin/commits
  25. # Backup before merge
  26. git tag before-merge refs/notes/commits
  27. git notes merge -v origin/commits
  28. # Undo merge
  29. git update-ref refs/notes/commits before-merge
  30. # Do rebase instead
  31. git switch --detach notes/commits
  32. git rebase notes/origin/commits
  33. git update-ref refs/notes/commits @
  34. git switch -q -
  35. git tag --delete before-merge
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement