例如:
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
例如:
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
问题是几乎可以肯定你的配置; 假设你有,否则默认的配置,你需要设置notes.rewriteRef
选项refs/notes/commits
这个工作。
神奇的命令,你需要是这样的:
git config notes.rewriteRef refs/notes/commits
在上述过程之后,压垮提交应该加入两个音符。
他们有他们之间的换行符,但是, 所以你在同一条线上的东西在你的例子就需要在Git的源代码黑客围绕我怀疑禁止这种行为。
从git help config
(重点煤矿):
notes.rewriteRef
当重写时复制笔记,指定了(完全合格的)裁判,其注意事项应该被复制。 裁判可以是圆顶封装,其中,在所有匹配参案例说明将被复制。 你也可以指定该配置几次。
没有默认值; 您必须配置此变量,以使音符重写。 将其设置为
refs/notes/commits
,以使改写默认提交笔记。此设置可以与该覆盖
GIT_NOTES_REWRITE_REF
环境变量,它必须是参或水珠的冒号分隔的列表。
(还参见描述notes.rewriteMode
和notes.rewrite.<command>
,这两者默认为我们所需要的,即该值的concatenate
和true
分别)。
下面是上面的测试类似的东西:
$ git init
Initialized empty Git repository
$ git config notes.rewriteRef refs/notes/commits
$ git add a # Here's a file I created earlier
$ git commit -am 'Initial commit'
[master (root-commit) 93219cb] Initial commit
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 a
$ echo a >>a
$ git commit -am 'Something'
[master 3c17aca] Something
1 files changed, 1 insertions(+), 0 deletions(-)
$ git notes append -m 'Dark '
$ echo b >>a
$ git commit -am 'Something'
[master 6732d81] Something
1 files changed, 1 insertions(+), 0 deletions(-)
$ git notes append -m 'Side'
$ git rebase -i HEAD~2 # Will squash the last commit into the one before and accept the default commit message.
[detached HEAD 552668b] Something
1 files changed, 2 insertions(+), 0 deletions(-)
Successfully rebased and updated refs/heads/master.
$ git show
commit 552668b4b96e4b2f8fcd7763dcc115edd159eb89 (HEAD, master)
Author: me_and <not.an@email.address>
Date: Wed Jan 30 10:09:10 2013 +0000
Something
Something
Notes:
Dark
Side
diff --git a/a b/a
index 7898192..4ac2bee 100644
--- a/a
+++ b/a
@@ -1 +1,3 @@
a
+a
+b