我还没有从这里的众多答案和博客文章中拼凑出我想知道的东西,所以我问了这个问题:
如何分叉一个 git repo 以便获得上游的所有分支和标签?
我试过的是:
git init
git remote add origin <ORIGIN_URL> # i.e. my repo
git remote add upstream <UPSTREAM_URL> # i.e. the repo I want to fork
git fetch upstream
git push --all origin
但是当我期望它起作用时,最后一行失败了。我明白了:
$ git push --all origin
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to <ORIGIN_URL>
有任何想法吗?
编辑:
也许你可以把这个问题想象成“当你点击 fork 按钮时 GitHub 实际上做了什么?”,因为这就是我想要复制的行为。