Checkout branch on different remote

感情迁移 提交于 2019-12-03 09:46:19
mu 無

Just fetch the refs from the remote (this will fetch all branch, commit, refs etc for the upstream repo)

git fetch upstream

After this, checkout the needed branch (this creates a local copy of the branch)

git checkout -b <branchname> --track upstream/<branchname>

Now if you want to pull the changes in this branch in future, all you need to do is

git pull upstream <branchname>

As mentioned here, try doing an explicit fetch on the branch name:

git fetch upstream master:branch_name

If you just added the remote, you'll need to fetch it so that Git knows which branches are available:

git fetch upstream master

After this you can do

git checkout upstream/master

without any issues.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!