I searched StackOverflow for similar questions but it always seems people are trying to get from their branch onto master. For me it's the opposite. I'm on master and trying to checkout to a branch that has already been pushed.
When I do:
git checkout mybranch
I get:
error: Your local changes to the following files would be overwritten by checkout:
db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting
I've tried with:
git checkout -f mybranch
but I get the message:
error: Entry 'db/structure.sql' not uptodate. Cannot merge.
If I try to stash or commit, it makes no difference:
git stash
No local changes to save
git checkout mybranch
error: Your local changes to the following files would be overwritten by checkout:
db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting
or
git commit
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
git checkout mybranch
error: Your local changes to the following files would be overwritten by checkout:
db/structure.sql
Please commit your changes or stash them before you switch branches.
Aborting
git submodule status
returns nothing, and git status -u
returns:
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Any suggestions as to what to do to fix this?