Git: 'Master cannot be resolved to branch' after merge

匿名 (未验证) 提交于 2019-12-03 02:25:01

问题:

Every time I merge a branch back into my master branch, I can no longer push to origin. I get the message fatal: master cannot be resolved to branch

I made a simple test change:

  • Created a new branch git branch TestBranch
  • Made a change to TestBranch and commited
  • Checked out back to master git checkout Master
  • Merged TestBranch git merge TestBranch

The merge seems to have gone fine, but now when I use Git status the Master branch does not tell me that it is ahead of the origin. And when I try to push to origin Master I get the message above.

Does anybody know what is causing this problem?

回答1:

Could it be that you write Master instead of master? If the system is case sensitive they wouldn't match, and lower-case master is the default in most repositories.



回答2:

Another issue might be this with your workflow:

Created a new branch git branch TestBranch

With the command above, you create a branch, but do not switch to it.

I believe you should checkout manually by git checkout TestBranch or create the branch with checkout and create it by git checkout -b TestBranch.



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