本地删除分支后git fetch不起作用

时间:2017-05-11 21:02:55

标签: git

所以,给出一个上下文值得一点历史。

我在本地分支上进行了rebase / reset,并将其推送到origin

现在,是时候将更改下载到测试服务器了:

git pull (or git pull --force, etc)

没有用,给我这个消息;

forge@myrepository:~/test.myserver.com$ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:ykgw/myrepository
+ 6ef07eb...9883f8a feature/558-add-preview-button -> origin/feature/558-add-preview-button  (forced update)
Auto-merging app/api/NodesController.php
CONFLICT (content): Merge conflict in app/api/NodesController.php
Automatic merge failed; fix conflicts and then commit the result.

forge@myrepository:~/test.myserver.com$ git checkout master
app/api/NodesController.php: needs merge
error: you need to resolve your current index first
forge@myrepository:~/test.myserver.com$ git pull --force
U   app/api/NodesController.php
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
                                                                     as appropriate to mark resolution, or use 'git commit -a'.

我终于能够切换到master并删除有问题的分支,但是git fetch没有显示我想要删除的分支。如何让测试服务器在repo中重新识别它?

1 个答案:

答案 0 :(得分:0)

当你告诉它时,Git只会对远程服务器说话。因此,它将远程存储库的副本保存在&#34;远程跟踪分支&#34;中。 master是一个远程跟踪分支,它是来自远程{{​​1}}的{​​{1}}的副本。

origin是一个本地分支,可能是master的分支。

origin/master不会触及本地分支,它会更新远程跟踪分支。基本上它会更新您的遥控器视图。因此,git fetch会更新git fetch,但不会将这些更新合并到origin/master,也不会创建master

您需要master来更新您当地的分支机构。 git pull基本上是git pull origin master + git fetch origin