Git: impossible to pick cherry

I got into a weird loop trying to pick a cherry pick. Here is what I am doing and where is the problem.

I have two branches: mainline and temp . I want the cherry to select a specific commit from mainline to temp. I do it as follows.

  • git checkout temp
  • git cherry pick <commit sha>
  • Now I get: Segmentation fault: 11
  • I will restart 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 the following:

    Error: the following files without a trace of the tree tree will be overwritten by merging: myfile.java

... for a file that does not even exist. I had this before, but I renamed it, so the file under this name is not in the repository.

  1. I run git status and now I see the myfile.java file in unverified files . And now he even appears in the editor. I can remove it from the editor, but I cannot delete it from the git repository. I get pathspec 'myfile.java' did not match any files
  2. OK, so I delete the file from the editor, re-run cherry-pick , and I will return to step 3) .

What is going on here and how can I make my cherry ?: D

+5
source share
2 answers

I do not know why you have a segmentation error. I suggest you work with the latest version of git.

Another way to select cherries is to create a patch from a commit and apply it:

 git checkout temp git format-patch -1 <commit sha> git apply 0001.....patch 
0
source

Updating to homegrown git 2.11.1 fixed the problem for me.

Based on the output messages and the dialog, this stretch request for git-for-windows, which was subsequently upstream, and this mailing list thread , for some reason, the return value from refresh_cache_entry() is null, which causes a segmentation error ( in my case, the way I had a cherry pick on doesn't exist on the branch I'm on)

Here's what happened to me:

 $ git cherry-pick d4c26fc1 Segmentation fault: 11 $ git cherry-pick --abort error: no cherry-pick or revert in progress fatal: cherry-pick failed $ rm .git/index.lock $ brew upgrade git Updating Homebrew... ... ==> Summary 🍺 /usr/local/Cellar/git/2.11.1: 1,456 files, 32.4M $ git cherry-pick d4c26fc1 error: addinfo_cache failed for path 'foo/bar/baz' error: could not apply d4c26fc... Some commit subject hint: after resolving the conflicts, mark the corrected paths hint: with 'git add <paths>' or 'git rm <paths>' hint: and commit the result with 'git commit' 
0
source

Source: https://habr.com/ru/post/1262489/


All Articles