I am working on a local branch where the remote version of the branch has been merged after a pull request was approved. The remote version of the branch was subsequently deleted after merging. So the branch only exists locally for me.
However, I can’t get out of the branch now because when I try to git checkout main
I get the error error: The following untracked working tree files would be overwritten by checkout:
with a list of files that I don’t care about.
All variants of the solution
git add *
git stash
git pull
have failed on git pull
with the error message
Your configuration specifies to merge with the ref 'refs/heads/mybranchname'
from the remote, but no such ref was fetched.
because the remote version no longer exists. I don’t want to do git clean
because there are some untracked files that I care about in my local directory. Help! How do I get unstuck?