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>
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.
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 get pathspec 'myfile.java' did not match any files
cherry-pick
and I am back to step 3). What is happening here, and how can I just do my cherry-pick? :D
It's exactly what it says: the changes you're trying to cherry-pick are already wholly contained in the branch you're on. I.e. the result of the cherry-pick is no changes. You can create an empty commit with the --allow-empty flag to indicate that you attempted to cherry-pick, but there were no changes to pull in.
If you look at the console, "fix conflicts and run "git cherry-pick --continue." When fixing conflicts the normal way (without the cherry-pick), the console will mention to commit (after the conflicts have been fixed).
as long as you have the hash of the commit, you can cherry-pick it.
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:
git checkout temp
git format-patch -1 <commit sha>
git apply 0001.....patch
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