【问题标题】:How to find the remote repo branch which i used earlier to checkout the remote repo url如何找到我之前用来签出远程 repo url 的远程 repo 分支
【发布时间】:2020-10-11 21:39:07
【问题描述】:

我正在运行 Jenkins 工作,并且已经使用特定分支完成了 git url 的结帐。 现在在下一阶段,我想获取 git 远程 repo url 和结帐分支。

为了获取远程 repo url,我使用此命令直接获取 url:- git config --get remote.origin.url 但我不确定使用哪个命令来获取结帐分支名称。 我试过git branch -r ,但这给出了所有的分支名称。

有人可以告诉命令是否有任何我可以直接获取 git 远程 repo 签出分支的地方。

【问题讨论】:

  • git status 报告当前分支。 git branch --list -vv "mybranch" 显示 mybranch 的上游

标签: git jenkins github


【解决方案1】:

使用git reflog。它为您提供最近 HEAD 移动的历史记录。

【讨论】:

    【解决方案2】:

    如果您使用的是 Git 版本 1.8.5 或更高版本,则可以使用以下命令:

    $ git status -sb
    ## mybranch...origin/mybranch
    

    在哪里

    -s, --short           show status concisely
    -b, --branch          show branch information
    

    【讨论】:

      猜你喜欢
      • 2014-03-18
      • 1970-01-01
      • 2016-10-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-07
      • 2010-12-19
      相关资源
      最近更新 更多