如何在一个裸git存储库上运行git describe?

时间:2014-01-06 08:09:25

标签: git

我的主机上有一个裸git存储库:

astropanic@localhost:~/production/repo$ ls -1
branches
config
description
FETCH_HEAD
HEAD
hooks
info
objects
packed-refs
refs

我如何在这里运行

git describe

没有将repo克隆到非裸(.git)?

1 个答案:

答案 0 :(得分:0)

您的git存储库不使用标记。对于git describe,您需要一个标记。摘自man - 页面:

The command finds the most recent tag that is reachable from a commit. If the tag
points to the commit, then only the tag is shown. Otherwise, it suffixes the tag
name with the number of additional commits on top of the tagged object and the
abbreviated object name of the most recent commit.

By default (without --all or --tags) git describe only shows annotated tags. For
more information about creating annotated tags see the -a and -s options to
git-tag

如果您在脚本中需要git describe而不是在描述调用中使用--always选项。

--always              show abbreviated commit object as fallback

或使用(带注释的)标签。也许你需要设置capistrano-clients获取标签信息。然后在每个客户端上使用git fetch --tags