Issue
Suppose I have a new system with no git history and I take a fresh checkout of branch A. Branch A already has a commit C1 which I did yesterday from some other system. Now I want to cherry-pick this commit C1 in branch B. Issue:
- If I take checkout of branch A and go to commit C1 (in history in Git view) and click 'cherry pick', it says do you want to cherry pick in branch A? So, there is no discussion of branch B here.
- If I take checkout of branch B it will not show commit C1 at all.
Now, how do I cherry pick commit C1 of branch A into branch B? I am using Gerrit, GitBlit and EGit in eclipse.
Solution
I'm not familiar with the GUI you are using in particular, but the concept you are describing is perfectly acceptable in git.
To cherry-pick a commit from branch A to branch B, use the following command line commands:
git checkout branchB
git cherry-pick hashOfC1
There should be a sort of 'view all branches' mode in the GUI you are using so that you can see commit C1 while having branch B checked out, but if not, the above commands are simple enough to execute.
Answered By - Ben Siver