Alex
Alex

Reputation: 2780

How to pull a commit from a different relation chain in Gerrit

Say I have the following two independent relation chains, how can I fulfill the two following scenarios:

Relation chain 1:
Commit A
Commit B

Relation chain 2:
Commit C

First scenario
How can I merge the changes from Commit A into Commit C and include the changes as part of the same commit? If I use the pull command from Gerrit it creates a merge commit rather than just adding the changes to staging.

Second scenario
How can I merge Commit C into Commit A during an interactive rebase? Again, using the Gerrit pull command results in a merge commit and I can't add the files to the rebase.

Upvotes: 0

Views: 1884

Answers (1)

For the first and second scenarios, use the "Cherry Pick" command instead of the "Pull" one.

If you don't want to create a new commit, add the "--no-commit" option to the "git cherry-pick FETCH_HEAD" command and, after that, commit manually using the "git commit --amend" command.

Upvotes: 1

Related Questions