[英]git stash: avoid “on <branch-name>” string in message
with git stash [save]
command, it always saves the stash with the string "on " prepended to whatever message I passed. 使用
git stash [save]
命令,它将始终使用我传递的任何消息开头的字符串“ on”保存存储。 Is there a way to tell git not to do that? 有没有办法告诉git不要这样做? Right now, I just vim
.git/logs/refs/stash
to manually remove it, but that's not preferable. 现在,我只是通过
.git/logs/refs/stash
来手动删除它,但这不是可取的。
Right now, as of Git 2.0.0, there is no way to tell Git not to prepend "on " to whatever message is passed to git stash [save]. 现在,从Git 2.0.0开始,没有办法告诉Git不要在传递给git stash [save]的任何消息之前加“ on”。
However, git-stash is implemented as a POSIX shell script . 但是, git-stash被实现为POSIX shell脚本 。 If you stare at this code, you'll eventually find that the "on " string is always prepended to whatever message you passed.
如果您盯着这段代码,最终会发现,“ on”字符串始终位于您传递的任何消息之前。
# create the stash
if test -z "$stash_msg"
then
stash_msg=$(printf 'WIP on %s' "$msg")
else
stash_msg=$(printf 'On %s: %s' "$branch" "$stash_msg")
fi
If this is an itch you want to scratch, clearly you can edit this file (on Ubuntu, for example, default git stores its scripts in /usr/lib/git-core). 如果这是您要抓的痒,显然您可以编辑此文件(例如,在Ubuntu上,默认git将其脚本存储在/ usr / lib / git-core中)。 I think it would make for a useful change, as git-blame shows this code was produced in 2005!
我认为这将带来有益的变化,因为git-blame显示此代码是2005年产生的!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.