必须在新服务器上设置central
存储库,所以我在本地存储库上建立了一个新的远程存储库,而后将其推送到该服务器。 git
但如今当我作git pull
,它声称我是最新的。 这是错的 - 它告诉我关于旧的远程分支,而不是新的远程分支,我知道事实上有新的提交提取。 服务器
如何更改本地分支以跟踪不一样的遥控器? fetch
我能够在git配置文件中看到这个,但我不想搞砸了。 url
[branch "master"] remote = oldserver merge = refs/heads/master
git fetch origin git checkout --track -b local_branch_name origin/branch_name
要么 spa
git fetch git checkout -b local_branch_name origin/branch_name
对我来讲,修复是: code
git remote set-url origin https://some_url/some_repo
而后: server
git push
使用最新的git(2.5.5)命令以下: rem
git branch --set-upstream-to=origin/branch
这将更新当前本地分支的远程跟踪分支 文档
对发生的事情进行大量控制的另外一个选择是手动编辑配置: get
git config --edit
或速记
git config -e
而后随意编辑文件,保存并应用您的修改。
git branch -u upstream-branch local-branch git branch --set-upstream-to=upstream-branch local-branch
这种用法彷佛与urschrei的答案略有不一样,由于在他的概要中是:
git branch local-branch -u upstream-branch git branch local-branch --set-upstream-to=upstream-branch
我猜他们又改变了文档?