For some reasons, I have to rewrite the entire history of my git repository to change the committer_id of every commit. However, I attached a note to more or less every commit and using git-filter-branch to change the committer_id will logically create new commits, leaving the notes behind. Is there a way to copy the notes to their matching new commit?
This thread seems to ask similar questions but was left with no solution in 2011.
Thank you for your help!
The problem is probably that git-notes need some extra config to work the way you want it to. You probably need this configuration variable
git config notes.rewriteRef refs/notes/commits
From the documentation: https://git-scm.com/docs/git-notes#git-notes-notesrewriteRef:
GIT_NOTES_REWRITE_REF
When rewriting commits, which notes to copy from the original to the rewritten commit. Must be a colon-delimited list of refs or globs.
If not set in the environment, the list of notes to copy depends on the notes.rewrite. and notes.rewriteRef settings.
Basically, Git must have your permission to transfer the notes from the original commits to the new ones that you are rewriting. You could also see this Stackoverflow thread for a longer explanation:
Is there a way to automatically merge notes if commits for those notes get squashed?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With