【问题标题】:Why origin/head shows in a repo but not in other?为什么 origin/head 在 repo 中显示而不在其他中显示?
【发布时间】:2018-06-29 11:21:01
【问题描述】:

我创建了一个本地 git repo(git init),并在其中进行了一些提交。

然后我在 github 上做了一个 repo,并让我的本地 repo 与之合作:

git remote add origin url-of-my-remote-gitrepo

我将本地提交推送到远程 git repo:

git push origin master

现在我将远程 git repo 克隆到我计算机上的另一个目录中。

所以现在我有两个与同一个远程仓库关联的本地 git 仓库。

当我这样做时:

git log --decorate

第一个 repo 显示了我创建的所有分支和 origin/master。但第二个也显示 origin/HEAD。

为什么会这样?

【问题讨论】:

    标签: git


    【解决方案1】:

    因为您只将本地 master 分支推送到远程 GitHub 存储库。

    如果你的远程仓库只包含那个分支,那就是你在第二个仓库中看到的那个。

    git push --all -u would have pushed all branches.
    即便如此,在您的第二个 repo 中,您仍需要(查看 所有 分支):

    git log --decorate --graph --oneline --all --branches
                                         ^^^^^^^^^^^^^^^^
    

    【讨论】:

    猜你喜欢
    • 2010-09-26
    • 2022-08-19
    • 2019-06-01
    • 1970-01-01
    • 2014-03-05
    • 2012-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多