For example:
git commit -am "Something"
git notes append -m "Dark "
git commit -am "Something"
git notes append -m "Side"
git rebase -i
# now I squash two commits and I expect to see "Dark Side" here
# but it show that note is undefined
git notes show
The problem is almost certainly your config; assuming you have otherwise default config, you need to set the
notes.rewriteRef
option torefs/notes/commits
for this to work.The magic command you need is thus:
After the above, squashing the commits should join the two notes.
They will have newlines between them, however; I suspect disabling that behaviour so you get things on the same line as in your example would require hacking around in the Git source code.
Background
From
git help config
(emphasis mine):(See also the descriptions for
notes.rewriteMode
andnotes.rewrite.<command>
, both of which default to the values we need, ieconcatenate
andtrue
respectively.)Example
Here's something similar for the above test: