简体   繁体   English

迭代最新的 git 标签

[英]Iterating over latest git tags

I would like to iterate over latest versions of git tags, that means crawling through their content.我想迭代最新版本的 git 标签,这意味着爬行它们的内容。 I am looking for solution that will: from list of example tags:我正在寻找解决方案:从示例标签列表中:

A@1.0.0
A@1.1.0
A@2.1.0
B@1.0.0
B@1.0.1
C@1.0.0

will choose A@2.1.0 B@1.0.1 C@1.0.0 and iterate through their content to let me grep for one regex.将选择A@2.1.0 B@1.0.1 C@1.0.0并遍历它们的内容让我 grep 一个正则表达式。 Just like I would checkout each and use grep from the level of project.就像我会检查每个项目并从项目级别使用 grep 一样。 I've tried using this:我试过用这个:

git ls-remote --tags

but it lists all tags and doesn't open their content.但它列出了所有标签并且不会打开它们的内容。

I think the easiest solution for this is to write a little script (bash, powershell, python, ...):我认为最简单的解决方案是编写一个小脚本(bash、powershell、python 等):

  1. Get list of all git tags by git tag通过git tag获取所有 git 标签的列表
  2. Checkout 1. tag结帐 1. 标签
  3. Do what you want to do做你想做的事
  4. Checkout 2. tag结帐 2. 标签
  5. Do what you want to do做你想做的事
  6. ... ...

Maybe as an alternativ, you can take a look at the option of git log .也许作为替代,您可以查看git log的选项。 With git log --all -S <text> you are able to search for in the whole history.使用git log --all -S <text>您可以在整个历史记录中进行搜索。 (Use git log --all -G <text> for RegEx search) (使用git log --all -G <text>进行正则表达式搜索)

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

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