简体   繁体   English

如何检索Git分支的描述?

[英]How can I retrieve the description of a Git branch?

Git supports branch descriptions. Git支持分支描述。 They can be edited with git branch --edit-description . 可以使用git branch --edit-description编辑它们。

How can I retrieve that description from the command line for consumption by other shell utilities? 如何从命令行检索该描述以供其他Shell实用程序使用?

One way to do this is to temporarily set $EDITOR (or core.editor) to cat or an equivalent before calling git branch --edit-description , but it is somewhat invasive, and it returns several comment lines that I would prefer to do without (even though filtering them would be an option if there is no better way). 一种方法是在调用git branch --edit-description之前,将$EDITOR (或core.editor)临时设置$EDITOR cat或等价物,但这有点侵入性,并且它返回一些我希望做的注释行没有(即使没有更好的方法,即使对它们进行过滤也是一种选择)。

git config --get-all branch.$branch.description

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM