git-notes
is used to add or inspect object notes. How can I delete a git-notes
commit, so the commit of git-notes command will not exist in git history. I want to delete git-notes commit, I'm not mean the "git-notes remove", which only remove that notes and make another commit.
As git stores notes on a separate (orphaned) branch (pointed by refs/notes/commits
by default), you can create branch, pointing at notes head, edit it as usual (using rebase
, for example), and update notes reference to the tip of that 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
git notes prune
Removes all notes for non-existing/unreachable objects.
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