Git列出了所有分支机构

时间:2017-03-10 09:16:31

标签: git

我知道git branch列出了所有本地分支 但有没有办法列出现有的分支,但被删除了?

我对此的用法是出于命名目的。

如果某个分支上的某个功能早先在某个分支上被实现,那么该分支在删除之后会被批量处理,那么在稍后处理相同的功能时,需要重复使用相同的分支名称。

1 个答案:

答案 0 :(得分:0)

IMO一个好的,可靠的方法是通过git标签。 功能完成后,您可以创建git tag,并在注释中包含分支名称。

  git tag -a v1.4 -m "<branch_name> blabla"

这样,您可以列出标签并间接列出现有的分支:

  # outputs tags with their comments
  git tag -l -n

  #output would be
  v1.1     <feature_branch_name> comment blabla
  v1.2     <other_feature_branch_name> other_comment blabla
  ....