I am caught up in a weird loop while trying to cherry pick. Here is what I do, and where the problem is.
I have two branches: mainline, and temp. I want to cherry-pick a specific commit from mainline to temp. I am doing this like follows.
git checkout temp
git cherry pick <commit sha>
- Now, I get:
Segmentation fault: 11
I rerun the command from 2), and get:
Unable to create ...git/index.lock': File exists
====================================================================
Now I run
rm -f ./.git/index.lock
Try again
git cherry pick <commit sha>
Now I get this:
error: The following untracked working tree files would be overwritten by merge: myfile.java
... for a file which isn't even there. I had it before, but I renamed it, so file under that name is not in a repository.
- I run
git status
and now I see the file myfile.java under untracked files. And now it even appears in the editor. I can delete it from the editor, but can't delete it from git repository. I getpathspec 'myfile.java' did not match any files
- OK, so I delete the file from editor, rerun
cherry-pick
and I am back to step 3).
What is happening here, and how can I just do my cherry-pick? :D
I don't know why you have a segmentation fault. I suggest to make sure you work with the latest git version.
A different way to cherry pick would be to create a patch from the commit and apply it: