In source control management, the act of selectively pulling single changes from peer to peer is called "cherry-pick".
Questions tagged [cherry-pick]
448 questions
24
votes
2 answers
git cherry-pick -x default
In the man page for git cherry-pick:
...
-x
When recording the commit, append a line that says "(cherry picked
from commit …)" to the original commit message in order to indicate
which commit this change was cherry-picked from. ...
-r
…

vergenzt
- 9,669
- 4
- 40
- 47
23
votes
5 answers
Error pushing changes on GIT. Ref names must follow git ref-format rules
I have one error using git on Sourcetree.
I've created a local branch called sprints/Mycompany_sprint_1 (because I want it in a category) and then I did multiple cherry picks to this branch from another one.
After that, I tried to push all the…

Inazense
- 1,517
- 3
- 18
- 28
22
votes
2 answers
git stable branch: find not cherry-picked commits
I have the following git history:
A --- B --- C --- D' --- E' [master]
\
\ --- D --- E --- F [stable]
We have a policy to cherry-pick all changes from stable to master; D' and E' are cherry-picked commits from stable branch, F is not…

Niko Sams
- 4,304
- 3
- 25
- 44
22
votes
2 answers
Why does this cherry-pick have a conflict?
I know git cherry-pick is a command that use to apply the changes of specified commit, but I think I just don't really understand the way it works.
Let's say a repo act like that:
git init
echo a>a
git add .; git commit -am 'master add line a'
git…

L_K
- 2,838
- 2
- 16
- 36
20
votes
3 answers
Git merge/cherry-pick avoiding staging
I am trying to make a cherry-pick with some changes, but I do not want to commit them in this branch, I just want to have them locally.
For this purpose, I am using
git cherry-pick --no-commit
However, this adds them automatically to the…

Mayday
- 4,680
- 5
- 24
- 58
20
votes
2 answers
git cherry-pick does not just pick the diff of the commit
I have two branches: A and B.
A's commit history: a <- b <- c;
B's commit history: a <- h <- i;
Assume that there is only one file here.
In commit b, I adds some texts like "foo".
In commit c, I adds some texts like "bar".
Then I git cherry-pick…

tamlok
- 697
- 1
- 5
- 15
18
votes
3 answers
Git: move changes between branches without working directory change
Use-case: every time I want to move commit from one git branch to another I perform the following sequence of actions:
[commit into working branch]
git checkout branch-to-merge-into
git cherry-pick target-commit
git push
git checkout…

denis.zhdanov
- 3,734
- 20
- 25
18
votes
2 answers
Git cherry pick and datamodel integrity
Given that two branches have diverged and a specific commit from one branch (and not everything) needs to be introduced to the other, git cherry pick achieves exactly that.
After some time there is the need to completely merge the two branches. How…

yannisf
- 6,016
- 9
- 39
- 61
18
votes
2 answers
How can one determine the committer of a cherry-pick in Git?
In Git, cherry-pick retains the original commit's author, timestamp etc, at least when there are no conflicts. But is there any way to determine what user performed the cherry-pick which brought that commit to the new branch?

John Lehmann
- 7,975
- 4
- 58
- 71
17
votes
2 answers
error: addinfo_cache failed while cherrypicking
I am getting the followinge error while cherry-picking a gerrit...does anyone have info on what this means and why would anyone see it?
error: addinfo_cache failed for path 'ROE/NAS/src/abc.c

carte blanche
- 10,796
- 14
- 46
- 65
16
votes
2 answers
Issue with cherry pick: changes from previous commits are also applied
In my project, I released a version several months ago. After that release, I have done many changes on the master branch.
If I encounter some bugs which were there in the last release, I fix them on the master branch, then cherry pick them to the…

Lahiru Chandima
- 22,324
- 22
- 103
- 179
16
votes
6 answers
How to cherry pick from branch A to branch B on a system without history?
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…

Farrukh Chishti
- 7,652
- 10
- 36
- 60
15
votes
6 answers
git cherry-pick says local changes exist, but git status says nothing
$ git cherry-pick 5de83068
error: Your local changes to the following files would be overwritten by merge:
Components/ApplicationEnums/Application.cs
Please, commit your changes or stash them before you can merge.
Aborting
$ git status
# On…

Benjol
- 63,995
- 54
- 186
- 268
14
votes
3 answers
Git workflow and Gerrit
I am trying to implement a 'git-flow' kind of workflow using Gerrit but I can't seem to figure out the last piece of the puzzle.
There are two preconditions to my problem:
Gerrit will only perform merging to one branch
I do not allow merge commits…

Ivo
- 519
- 2
- 9
- 21
14
votes
1 answer
Copy 1 commit from one branch (dev) to another (stable) with clean working dir
I tried to understand How to undo a commit and commit the changes into the other branch in Git? but I don't think it has to be that hard. (Answer is using branch -f and stash and I don't think I need those.)
I was working in my dev branch. Had two…

Rudie
- 52,220
- 42
- 131
- 173