git branch
告诉我我在主人。 我写git checkout -b newbranch
。 git branch
告诉我,我在新创建的分支newbranch。 我写git pull
,并出现以下错误:为什么创建git分支不会复制所有文件?
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> newbranch
我想这是因为我无法从我刚刚创建了一个分支拉。所以我写git pull origin master
并获得一百万文件分支主和newbranch之间差异有以下结局(以我的全控制台,所以我不能看到错误的开始):
Please move or remove them before you can merge.
Aborting
我不明白为什么分支newbranch不是主人的确切副本。从我读的时候,当我创建一个新的分支时,它从我所处的分支开始。我只是想让git pull
确保所有文件都与主文件完全相同。如果新分支不是从其复制的分支的确切副本,我不知道所有文件都来自哪里。
编辑: 大家都提到,问题是我的本地主人不同于远程主人。所以,我不得不这样做:
git checkout master
git branch -d newbranch
git fetch --all
# change permision issues with chmod and chown
git reset --hard origin/master
git checkout -b newbranch
你创造你的'newbranch'你的*本地*主分支。如果稍后在执行'git pull origin master'时收到更改,那么显然您的本地主分支已过时。 – poke