CourtneyJ
CourtneyJ

Reputation: 508

git push -> Branch cannot be resolved

I keep running into this same issue when I try and push up a new remote branch to github and Im not sure how to handle it. This is whats happening:

  1. I create a branch for example git checkout -b feature/5110
  2. Make my changes to that branch
  3. Commit those changes git add . git commit -m "made changes"
  4. Then I checkout to my develop branch git checkout develop (if for one reason or another I am unable to push at that time)
  5. When I return to that branch git checkout feature/5110 I try and push git push
  6. I get the message :

To push the current branch and set the remote as upstream, use

`git push --set-upstream origin feature/5110`
  1. So I run git push --set-upstream origin feature/5110
  2. Then I get the error :

fatal: feature/5110 cannot be resolved to branch.

The only way ive found to work around this is to delete my branch and start over which is not effective now that I'm making larger changes. Can anyone tell me whats happening and how to resolve?

Upvotes: 1

Views: 7459

Answers (1)

CourtneyJ
CourtneyJ

Reputation: 508

The issue here was that vscode was not properly switching branches. I did git branch and found no green highlight indicating which branch I was in. Ended up having to close and relaunch vscode then git checkout theBranch then I did git branch to verify I was in the right branch and I was able to push up after this.

Upvotes: 1

Related Questions