Questions tagged [cherry-pick]

In source control management, the act of selectively pulling single changes from peer to peer is called "cherry-pick".

448 questions
13
votes
1 answer

How to cherry-pick interactively

I have hacked on a branch for a while, and this branch won't be merge before long. But there are some commits I'd like to merge in the master anyway. Is there a way to get an interactive cherry-pick, that would show the commits and their changes,…
greg0ire
  • 22,714
  • 16
  • 72
  • 101
13
votes
2 answers

What are the differences between git cherry-pick and git show | patch -p1?

I ran into a situation where git cherry-pick X would have some conflicts, but also created extra inserts (when verified with git diff). I then re-ran git show X > my.patch, and then did patch -p1 < my.patch on my tree. I got better results, some…
0x6adb015
  • 7,473
  • 4
  • 24
  • 38
12
votes
1 answer

Git - Cherry picking with ours/theirs strategy

I wonder if there is any way of cherry picking with ours/theirs strategy. On other words, I want to cherry pick multiple commits from dev branch into main branch with below commands, git cherry-pick HASH1 HASH2 HASH3 -n This command is supposed to…
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
12
votes
1 answer

How do I go to a specific commit using git-subtree?

I am using Avery Pennarun's git-subtree which is an extension to git. How do I cherry-pick a commit from a sub-repo into my main repo using git subtree? Also how do I go to a specific commit in the history of the sub-repo after I have already done…
owagh
  • 3,428
  • 2
  • 31
  • 53
11
votes
4 answers

How to cherry-pick changes from one file to another file?

I have two files called vvn.c and aqu.c I did changes to vvn.c and I have that commit in my git. How to cherry-pick the same changes to aqu.c The only difference is the API's. vvn.c contains API's as vvn_function_names() whereas aqu.c contains…
optimus prime
  • 764
  • 1
  • 13
  • 39
11
votes
1 answer

Workflow to "backport" change into different Mercurial (Hg) branch?

We have two heads. One is our main development head and the other is one that I forgot about until today. We found a bug and fixed it in our main development branch, and I just realized it should be fixed in the older branch as well. I think it…
oob
  • 1,948
  • 3
  • 26
  • 48
10
votes
2 answers

Why cherry-pick pick change more than one commit?

I have 2 branches here, say branch1 and branch2. There are lots of new feature added in branch1, and the branch2 is stable. Today, I want to merge just 1 feature from branch1 to branch2. So, I just run git cherry-pick…
Rocky
  • 5,486
  • 8
  • 32
  • 36
10
votes
1 answer

How to git cherry-pick a commit with binary files

I am trying to cherry-pick a commit from a different branch that is mostly binary files. It seems it is mostly successful, except for one file where I get the message: warning: Cannot merge binary files: XXXX.so (HEAD vs. d8ef550... Add support for…
Sofia Clover
  • 669
  • 1
  • 7
  • 18
10
votes
1 answer

Why does git cherry-pick not continue?

I am trying to cherry-pick changes from two different working brachnes to each other namely I want to cherry-pick the last 5 commits from branch linear to branch diagonal. git cherry-pick -n -x linear~6..linear As expected there are some merging…
benni
  • 663
  • 1
  • 6
  • 21
10
votes
3 answers

Git - Is cherry-picking a bad practice if I want to have a consistent workflow?

I find cherry-pick particularly useful in some cases, e.g., when I have a feature1 branch, and a test-feature1 branch, and I want to apply corrections found in tests; or the other way, I want to test new functions, for which I need those new…
Julen
  • 1,024
  • 1
  • 13
  • 29
10
votes
2 answers

git says everything-up-to-date when pushing changes to a remote branch

i have commits that are in a remote repository (origin/master) which i want to put in a branch created from that repository (origin/remote_branch). when i checkout to that remote branch git checkout -b mybranch origin/remote_branch then…
paolo granada lim
  • 540
  • 1
  • 5
  • 13
9
votes
1 answer

What git hooks can be executed on cherry-pick operation?

I am trying to find a way to check commits when cherry-picking them. Unfortunately, I cannot find a git hook that works with cherry-pick operation. What would be a possible solution to execute a script on cherry-picked commit?
ziemowit141
  • 465
  • 3
  • 18
9
votes
2 answers

cherry-picking a commit includes previous commits?

After finishing https://learngitbranching.js.org, I thought I got the idea of cherry-pick, but turned out that I didn't, at all. I created a file abc.txt and made the commits like below: (write a) ← (write b) ← (write c)[master][HEAD] by which…
akai
  • 2,498
  • 4
  • 24
  • 46
9
votes
3 answers

cherry-picking with git-svn

I'm facing the problem of merging a subset of revisions from one topic-branch to another. Since I am using git-svn, I was curious to see if it is possible to use cherry-picking for this. Using Subversion, I would do: svn merge -c A svn merge -c…
JesperE
  • 63,317
  • 21
  • 138
  • 197
9
votes
4 answers

Git cherry-pick causes merge conflict while merging does not

I am trying to learn how to use git cherry pick, I read the manual pages that git returns by doing git cherry-pick --help but that did not seem to help. I will try and explain the problem below. I have two branches master and other. On branch…
Curious
  • 20,870
  • 8
  • 61
  • 146