【发布时间】:2019-06-21 20:53:15
【问题描述】:
我不小心从远程开发分支切换到本地开发,现在无法切换回来。
当我尝试:
git fetch origin/master
我明白了
fatal: 'origin/master' 似乎不是 git 存储库。 致命:无法从远程存储库读取。
我也试过了:
git checkout origin/master
我得到了:
错误:pathspec 'origin' 与 git 已知的任何文件都不匹配。 错误:pathspec 'master' 与 git 已知的任何文件都不匹配。
我用 git remote -v 检查了我的来源的 url 在那里。同样在配置文件中显示正确的 url
remote.dev.url=https://'my_origin_url'.git
remote.dev.fetch=+refs/heads/*:refs/remotes/dev/*
remote.dev.pushurl=https://'my_origin_url.git
branch.dev.remote=dev
branch.dev.merge=refs/heads/dev
remote.origin.url=https://'my_origin_url'.git/
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
我试过了:
git reset --hard origin/master
结果是:
致命:模棱两可的参数“来源/主”:未知的修订或路径 不在工作树中。
我怎样才能回到我的原始分支?
【问题讨论】:
-
这两个独立的
pathspec ...错误表明您必须运行git checkout origin master。 Git 在这里可能会非常混乱:什么时候应该使用origin,什么时候应该使用master,什么时候应该使用origin/master,什么时候应该使用origin master?答案都不同! -
是的,我可能确实跑过
git checkout origin master:(你能告诉我下一步该怎么做吗? -
远程repo连接有问题,已解决并成功切换到origin分支,谢谢指教
标签: git bitbucket git-remote