I have been working on a project in the develop branch using git bash on my work computer. I have just attempted to checkout to the master branch as I intend to merge the changes, but when I attempt to do this the command line hangs indefinitely until I kill it with CTRL + C.
If I attempt to checkout again, I get the following error:
Another git process seems to be running in this repository, e.g. an editor opened by 'git commit'. Please make sure all processes are terminated then try again. If it still fails, a git process may have crashed in this repository earlier: remove the file manually to continue.
However, after deleting the index.lock file, attempting to use git checkout once again simply hangs in the terminal and never makes any progress until I kill the process once again! Etc.!
Has anyone come across this, and if so, how did you go about solving this issue?
Force a Checkout You can pass the -f or --force option with the git checkout command to force Git to switch branches, even if you have un-staged changes (in other words, the index of the working tree differs from HEAD ). Basically, it can be used to throw away local changes.
If you are using the git cli directly, pressing q in the keyboard will also do the job for you. Show activity on this post. ctrl + c is the most used task killing command for command based working windows.
If you are using Windows, check to see if some Windows process has some file or files in that repository locked. If so, your git command will wait for that other process to release the lock, before proceeding. If that other process never lets go, Git never proceeds.
I had Textpad open on a file, and I think its locking caused this (same as spiralx mentioned about Sublime Text's aggressive indexing locking files). Even though I closed Textpad, I still could not switch the branch. I rebooted my VM, and then all was well - no more hanging. :-)
I've been having the same issue very recently and it appears to be related to Sublime Text's aggressive indexing locking files in my tree - if you're using ST then try deleting the lock file, closing ST and then running git checkout master
again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With