How do I update my local branch of forked repo

How do I update my branch of my forked repo with the current changes in the master of the main repo. The scenario is I have forked a repo(say A ) and also cloned it in my machine. Now I created a branch(say xyz ) and created a PR in the original repo. Now it's been a while and the original repo is way ahead in commits. Now I wish to update my branch( xyz ) with the latest changes in that file.

I updated my local by creating an upstream, fetching and pulling it. This worked for the master branch. But if I do the same with xyz it says:

fatal: Couldn't find remote ref xyz .

I am not able to figure out the issue.


If it worked for the master of your forked project. On your branch xyz , you can do :

git pull origin master 

If you try pulling the from the remote, it might fail since there is no link between the branch you created( xyz ) on the forked project and the original project.

Couldn't find remote ref xyz

states the same message anyway. In order to fetch some remote branch to your local branch, you should follow the syntax:

git fetch <remote> <rbranch>:<lbranch> 

as explained by @Mark here.

链接地址: http://www.djcxy.com/p/26156.html

上一篇: 如何从Dev Branch中取出最新文件而不是主人?

下一篇: 如何更新我的分叉回购的本地分支