标签之间的Git日志失败并带有特定标签

时间:2015-08-07 10:54:36

标签: git git-log

我有一个脚本可以为我制作更改日志。在这个脚本中我使用git log tag1..tag2。一切都很好,直到我遇到问题

fatal: ambiguous argument 'abc-5.0.0.11..abc-5.0.0.12': unknown revision or path not in the working
tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument 'abc-5.0.0.10..abc-5.0.0.11': unknown revision or path not in the working
tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

我发现这些标签之间存在另一个标签:abc-5.0.0.11-4-SNAPSHOT - 我认为这个标签是主要原因。

发生错误的标签列表:

  • ABC-5.0.0.12
  • ABC-5.0.0.11-4-SNAPSHOT
  • ABC-5.0.0.10

脚本搜索:

git log $tag1..$tag2 --pretty=format:"%cd -- %s -- %cn -- %ce" --date=iso --simplify-merges --dense

我怎么能避免这个问题?

1 个答案:

答案 0 :(得分:1)

我认为如果脚本本身会检索完全匹配会更好,但是您可以执行以下操作来自动扩展标记:

git log $(git tag -l | grep -F $tag1)..$(git tag -l | grep -F $tag2) --pretty=format:"%cd -- %s -- %cn -- %ce" --date=iso --simplify-merges --dense
相关问题