【问题标题】:get a list of all tags on a remote with gitpython使用 gitpython 获取遥控器上所有标签的列表
【发布时间】:2021-10-07 09:35:45
【问题描述】:

我想使用gitpython 获取遥控器上的标签排序列表。

这里的答案gitpython-tags-sorted返回本地仓库中的标签列表。

我目前从远程获取当前标签的解决方案是在列出所有标签之前在 git shell 中运行此命令:git fetch --prune origin "+refs/tags/*:refs/tags/。我如何使用gitpython 完成此操作?

【问题讨论】:

    标签: python gitpython


    【解决方案1】:

    这会给出一个未解码的字符串,其中包含远程标签和关联的提交

    import git
    
    repo = git.Repo("path_to_local_repo")
    
    tagList=repo.git.ls_remote("--tags", "origin")
    

    【讨论】:

      猜你喜欢
      • 2013-07-05
      • 2016-12-27
      • 2018-08-08
      • 2019-10-30
      • 2018-12-12
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      相关资源
      最近更新 更多