How to remove git-notes commit?

git-notes used to add or verify object notes. How can I remove the git-notes commit, so the git-notes command commit will not exist in the git history. I want to remove git-notes commit, I do not mean "git-notes remove", which delete only these notes and make another commit.

+8
git
source share
3 answers

As git stores notes on a separate (orphaned) branch ( refs/notes/commits specified by default), you can create a branch by pointing to the note head, edit it as usual (using, for example, rebase ), and update the links to the tip of this branch :

 // create branch pointing to the tip of notes branch git checkout -B notes-editing refs/notes/commits // do whatever you want with notes-editing branch // for example, git reset --hard HEAD^ to remove last commit // reset notes reference to the tip of temporary branch git update-ref refs/notes/commits notes-editing // remove temporary branch git checkout master git branch -D notes-editing 
+5
source share

git notes prune Deletes all notes for nonexistent / inaccessible objects.

+1
source share

git notes does not create its own commit.

In fact, it can be used to add ( git notes add ) some notes to an existing commit.

When you call git notes remove , the notes are deleted and the native commit is not executed again.

-2
source share

All Articles