How to choose a cherry from branch A to branch B in a system without history?

Suppose I have a new system without git history, and I take a new check for branch A. There is already a C1 commit in branch A, which I made from some other system yesterday. Now I want cherry-pick this commit C1 in branch B. Question:

  • If I take a check of branch A and go to commit C1 (in the history in the git view) and press the "cherry pick", it says that you want to select a cherry in branch A? So, branch B is not discussed here.
  • If I take a check on branch B, it will not display commit C1 at all.

Now, how do I cherry grip commit C1 branches A to branch B? I use Gerrit, GitBlit and EGit in eclipse.

+6
source share
3 answers

I am not familiar with the graphical interface that you use in particular, but the concept you describe is perfectly acceptable in git.

To make the cherry pick a commit from branch A to branch B, use the following command line commands:

git checkout branchB git cherry-pick hashOfC1 

The GUI that you use should have some kind of view mode for all branches so that you can see commit C1 when branch B is displayed, but if not, the above commands are simple enough to execute.

+4
source

Qualatar's comment is a bit out of date, here's how to show all the branches in "Show History" in "Version: Luna SR2 (4.4.2)" so you can "right-click> Cherry Pick".

how to see all commits in Eclipse IDE EGIT for cherry picker

+8
source

goto "Team Synchronizing", right-click on the project to display the menu. Select the show In → History. This will display the History tab using change sets.

enter image description here history toolbar

when you click on the icon with 2 down arrows, you will see all the changes, even those that are not related to your branch. Right-click on the set of changes that you want to select, and then select the option "Cherry Peak ..", as shown in the figure.

enter image description here

+5
source

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


All Articles