Something wrong is going on with one of the files in my local git repository. When I\'m trying to change the branch it says:
Unlink of file \'templates/media
I tried every single tip on this page and nothing helped. I was doing a git fetch
and a git reset --hard origin/development
gave me the unkink error. I couldn't reset to the latest commit.
What helped was checking out another branch and then checking out the previous branch. Very strange but it solved the problem.
This might be useful for someone; if all the above didn't work for you, follow these steps:
Close your IDE (mine was Eclipse, not sure if it applies to Intellij and others) or any other app that might be using git.
Open git from the command line (in my case I had git bash) and run git gc
as mentioned by others.
This did the magic for me.
I had the same issue while doing a git pull and as stated above, it was because of a program that was holding those files and was not allowing a git pull. Closing the program helped. Usually, the IDE (like Eclipse) from where the files are being checked-in will be holding it in the background. Closing the same and re-running git pull solved the problem for me.
After trying various solutions finally git clean -f
helped me.
EDIT: I hit the problem again few times - closing all processes dependent on git seems to help (like gitbash, Eclipse IDE, etc.)
If you are developing a web application, a common reason is to forget shutting down the server. For example this could be a simple Node.js process, or on windows your IIS process running more unobtrusive as background process.
If you're using Docker and running Windows 10, you may want to stop the container(s) where the file may be running at. To show the statuses of your containers, run
docker ps -a
To stop them, simply run
docker stop <container name or container id>
This worked for me as I am running my local files using a .sh file