Git cherry is not working

I am trying to make a cherry grab from the host and get it in the current production branch. However, when I execute git cherry-pick <SHA-hash> , I just get this message:

 # On branch prod_20110801 # Untracked files: # (use "git add <file>..." to include in what will be committed) # site/test-result/ nothing added to commit but untracked files present (use "git add" to track) The previous cherry-pick is now empty, possibly due to conflict resolution. If you wish to commit it anyway, use: git commit --allow-empty Otherwise, please use 'git reset' 

Note. I tried doing reset and reset --hard HEAD ^, and nothing changed anything.

I am confused why this does not work for me.

Any insights, tips or ideas on how to resolve this will be helpful ~!

+63
git branching-and-merging cherry-pick
Aug 15 '11 at 23:33
source share
4 answers

Git allows the selection of cherries as no-op - all the changes made by this commit were introduced by some latches in your current branch. (Or what Git thinks). Make sure that the command you chose for the cherry has not yet been combined, either the correct merge, or reformatting, bird cherry or a phased patch. (Use git show <commit-id> to see the diff.)

+86
Aug 15 2018-11-11T00:
source share

In my case, it infuriated me, since it was quite obvious that the specific commit that I wanted to choose for the cherry pick was not merged into my current branch.

It turns out that someone already cherry took a fix a week before. Changes , but not specific SHAs, were already in my current branch, and I did not notice them.

Check the files (s) you are trying to select. If they already have changes, the commit version is already selected or added by cherry in another way. Thus, there is no need for the cherry to pick it again.

+6
Apr 14 '15 at 21:49
source share

Also note that adding an empty file (e.g. .gitkeep ) to the tree is considered using the cherry pick as an empty commit.

+1
May 9 '16 at 12:38
source share

So, here is another weird situation where this might arise: I had the following:

git log screenshot

I was trying to pick cherry pick 9a7b12e, which apparently was nothing - he even tried to tell me about this line in the git log output, that 4497428 was what I really wanted. (What I did was just look for the commit message and grabbed the first hash that I saw when it was). In any case, I just want to tell people that there is another way that you can fool the cherry trying to choose no op.

0
May 21 '17 at 4:17
source share



All Articles