Can't switch branch: untracked working tree fi

2019-07-01 17:35发布

问题:

I want to merge the develop branch into the master branch and I thougt I do something like this:

git checkout master
git merge --no-ff develop
git tag -a 1.0.0

but on checkout I get

git checkout master
error: The following untracked working tree files would be overwritten by checkout:
    Project/Resources/someimage.png
Please move or remove them before you can switch branches.
Aborting

But I have a file someImage.png in my develop branch and it seems that git has somehow an old file. Is GIT case-sensitive? On the local folder there is no such file.

Shoud I simply use git rm -f filename?

Edit:

Now I tried to delete the file, but I get

fatal: pathspec './Project/Resources/someimage.png' did not match any files

Now I'll try to checkout the master branch with -f.

回答1:

I forced the checkout like this

git checkout master -f

and the local differences should be ignored. I think through deleting and re-inserting the image there was a problem in the index or so.