Using git 1.7.10 on linux I am trying to use git rebase -i on a branch of about 100 commits. I regularly but not always run into this problem:
After I have indicated which changes I want to make… eg. I just do a reword quite near the upstream part, git keeps running and shows a counter in the command line while applying the commits: like [17/100]…
This should normally be a quite smooth operation but often it stops in the middle somewhere saying:
[detached HEAD 5e1a3c8] Commit message
Author: username
1 file changed, 14 insertions(+), 3 deletions(-)
fatal: Unable to create ‘/[path to repository]/.git/index.lock’: File exists.Could not apply 05e6b8ef Other commit message
When I run git rebase –continue I get shown the commit message of the current commit and when I close the file git rebase continues but it omits that commit… That is quite useless so for the moment I just do –abort, but it is a pain…
Maybe it will be possible to manually commit the problematic commit and then –continue, but I haven’t looked into that yet.
In any case when I go and check index.lock does not exist. Maybe it existed at the moment when git wanted to create it, but it definitely got removed before I can look at it with a file browser…
ps: I can’t seem to reproduce this if I don’t have gitg open while rebasing.
Any clues?
update: updating to gitg 2.6 seems to have solved the issue
That file is created to make sure two clients don’t interfere with each other working against the same repository. I used to get this problem with torgoisegit. It can happen at other times as well, it’s just that an interactive rebase is a fairly intensive operation, so you’re more likely to hit it then. Just close gitg and any other clients before you do your rebase.