Git isstructionFormat 在开始时带有填充,不适用于 git rebase Interactive

问题描述 投票:0回答:1

我想在用户名左边补空格,

[rebase]
    instructionFormat = %>(10)%al %as %s

但是,上面的行不起作用,它没有填充效果,但是如果我在 % 左侧添加任何字符,那么它就起作用。此外,

%<(10)
适用于
.gitconfig
。并且在命令行中也可以使用相同的格式。

git log -n 10 --pretty=format:"%>(10)%al %as %s"
git git-rebase git-config
1个回答
0
投票

git rebase
是罪魁祸首——它会修剪提交消息中的前导(也许是尾随)空格。

我创建了一个测试存储库,并在提交消息中添加了很多空格:

$ git log -5 --oneline 
94c44b6 Build(GHActions): Use `checkout@v4` instead of outdate>
8430ecc       Docs: Year 2024
0b6a56b Tests,CI: Python 3.12
990d1b5    Docs(ANNOUNCE): Fix backticks
c7205de CI(pip): Ensure `pip` only if needed

但是当我运行

git rebase -i @~5
时,它会向我显示经过修剪的消息:

pick c7205de CI(pip): Ensure `pip` only if needed
pick 990d1b5 Docs(ANNOUNCE): Fix backticks
pick 0b6a56b Tests,CI: Python 3.12
pick 8430ecc Docs: Year 2024
pick 94c44b6 Build(GHActions): Use `checkout@v4` instead of outdated `v2`

所以看来你不能在 rebase todo 文件中左键提交消息。

instructionFormat = |%>(10)%al %as %s
有效,但
instructionFormat = %>(10)%al %as %s
无效。

© www.soinside.com 2019 - 2024. All rights reserved.