【问题标题】:Creating new Tags创建新标签
【发布时间】:2014-08-01 05:48:25
【问题描述】:

只是想知道是否可以使用 Rugged 创建一个新的 GIT 标签。如果是这样,一个例子将不胜感激。

我基本上只是想在提交 oid 上创建/移动/删除标签。

【问题讨论】:

    标签: ruby git rugged


    【解决方案1】:

    你可以在test/tag_test.rb看到一些例子:

    @repo = sandbox_init("testrepo.git")
    @tag = @repo.tags.create('annotated_tag', "5b5b025afb0b4c913b4c338a42934a3863bf3644", {
      :message => "test tag message\n",
      :tagger => { :name => 'Scott', :email => 'schacon@gmail.com', :time => Time.now }
    })
    

    删除见test/reference_test.rb:

    tag = @repo.tags["test"]
    
    @repo.references.delete(tag)
    refute @repo.references.exists?("refs/tags/test")
    

    OP Chris Portman 指出in the comments

    创建/删除方法实际上是TagCollection class 的一部分。
    与分支和BranchCollection class 相同。

    【讨论】:

    • 谢谢,这为我指明了正确的方向。创建/删除方法实际上是 TagCollection 类的一部分。与分支和 BranchCollection 类保持一致。
    • @ChrisPortman 好点,我已将您的评论包含在答案中以获得更多可见性,并提供指向这些课程的链接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-10
    • 2021-05-16
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多