【问题标题】:Can I get the upstream remote branch by ruby-git我可以通过 ruby​​-git 获取上游远程分支吗
【发布时间】:2021-08-09 11:27:05
【问题描述】:

我正在使用ruby-git 来操作我的 Git 存储库。我可以获取从远程分支结帐的本地分支,如何获取上游远程分支?这是代码:

require 'Git'
repo = Git.open("xxxpath.git")
localbranch = repo.branches["localbranchnamexxx"]

【问题讨论】:

    标签: ruby git rubygems upstream-branch


    【解决方案1】:

    和普通的 git 一样

    remote_branch = repo.branches["origin/localbranchnamexxx"]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-03-21
      • 2021-01-13
      • 1970-01-01
      • 2015-10-28
      • 2011-01-15
      相关资源
      最近更新 更多