简体   繁体   English

git stash:避免“打开” <branch-name> 消息中的字符串

[英]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.

相关问题 Git结账差异git结账来源/ <branch-name> 和git结帐 <branch-name> ? - Git checkout difference git checkout origin/<branch-name> and git checkout <branch-name>? arc feature [branch-name]和git branch [branch-name]之间有什么区别? - What are the differences between arc feature [branch-name] and git branch [branch-name]? 我应该何时在git命令中使用“remote / branch-name”vs“remote branch-name”? - When should I use “remote/branch-name” vs “remote branch-name” in git commands? posh-git显示长分支名称 - posh-git shows long branch-name Git 按名称/消息删除存储 - Git delete stash by name/message 使用 `git push origin:branch-name` 有条件地删除远程分支……但前提是分支存在? - Conditionally delete a remote branch using `git push origin :branch-name` … but only if branch exists? git branch -D branch-name是否确实删除指定的分支 - Does git branch -D branch-name really deletes specified branch 为什么在git 1.5中git checkout“ origin / branch-name”导致“ no branch”? - Why does git checkout “origin/branch-name” lead to “no branch”, in git 1.5? `git pull` 不合并,但 `git pull origin<branch-name> `会,为什么?</branch-name> - `git pull` doesn't merge, but `git pull origin <branch-name>` does, why? 为什么我必须git pull origin <branch-name> 在git中? - Why do I have to git pull origin <branch-name> in git?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM