【问题标题】:Composer clones GIT Commit instead of TagComposer 克隆 GIT Commit 而不是 Tag
【发布时间】:2020-02-08 23:06:42
【问题描述】:

我已经分叉了一个 github 项目并想切换到我的分支。 我已将存储库条目添加到我的分叉 github 项目中,并且 composer 开始 克隆包。

Installing antibodies-online/omnipay-vr-payment (1.1.0): Cloning 7df29fad5d

接下来我检查原点是否是我的新分叉:

git remote -v

Output:
composer        https://github.com/DemigodCode/omnipay-vr-payment (fetch)
composer        https://github.com/DemigodCode/omnipay-vr-payment (push)
origin  https://github.com/DemigodCode/omnipay-vr-payment (fetch)
origin  https://github.com/DemigodCode/omnipay-vr-payment (push)

没关系,我的叉子。现在我想列出所有可用的分支:

git branch -a

Output:
* (no branch)
  master
  remotes/composer/2DS20
  remotes/composer/master
  remotes/origin/2DS20
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

我缺少没有遥控器/来源的 2DS20 分支。

如果我现在想切换到 2DS20:

git checkout 2DS20
error: pathspec '2DS20' did not match any file(s) known to git.

我不知道,这里发生了什么?在另一台服务器上它工作得很好。有什么想法吗?

在另一台服务器上,当我运行 git status 时,将打印以下内容:

# On Tag v1.1.0.
nothing to commit (working directory clean)

在我的机器上:

# Not currently on any branch.
nothing to commit (working directory clean)

【问题讨论】:

    标签: git github composer-php


    【解决方案1】:

    对于旧版本的 git,您必须更明确地说明起点。

    git checkout -b 2DS20 origin/2DS20
    

    git checkout documentation 解释了更新、更方便的行为。

    git checkout [<branch>]

    …如果没有找到<branch>,但在一个远程(称为<remote>)中确实存在一个具有匹配名称且未指定--no-guess 的跟踪分支,则视为等同于

    $ git checkout -b <branch> --track <remote>/<branch>
    

    【讨论】:

      【解决方案2】:

      对于所有其他面临该问题的人:

      Git 1.7.1 安装在我们的机器上。另一个运行 2.11.x。更新到 2.22.0,一切正常! 我们现在可以打字了

      git checkout my-branch
      

      它就像我期望的那样工作。

      【讨论】:

        猜你喜欢
        • 2018-02-02
        • 1970-01-01
        • 2012-10-08
        • 2014-02-26
        • 1970-01-01
        • 2017-06-17
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多