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
3237
votes
14 answers

What does cherry-picking a commit with Git mean?

What does git cherry-pick do?
Rahul
  • 44,892
  • 25
  • 73
  • 103
1463
votes
17 answers

How to cherry-pick multiple commits

I have two branches. Commit a is the head of one, while the other has b, c, d, e and f on top of a. I want to move c, d, e and f to first branch without commit b. Using cherry pick it is easy: checkout first branch cherry-pick one by one c to f and…
tig
  • 25,841
  • 10
  • 64
  • 96
1031
votes
14 answers

Is it possible to cherry-pick a commit from another git repository?

I'm working with a git repository that needs a commit from another git repository that knows nothing of the first. Typically I would cherry-pick using the HEAD@{x} in the reflog, but because this .git knows nothing of this reflog entry (different…
gitcoder182
  • 10,321
  • 3
  • 15
  • 4
857
votes
15 answers

How to cherry-pick only changes to certain files?

If I want to merge into a Git branch the changes made only to some of the files changed in a particular commit which includes changes to multiple files, how can this be achieved? Suppose the Git commit called stuff has changes to files A, B, C, and…
Tobias Kienzler
  • 25,759
  • 22
  • 127
  • 221
837
votes
5 answers

git cherry-pick says "...38c74d is a merge but no -m option was given"

I made some changes in my master branch and want to bring those upstream. When I cherry-pick the following commits. However, I get stuck on fd9f578 where git says: $ git cherry-pick fd9f578 fatal: Commit fd9f57850f6b94b7906e5bbe51a0d75bf638c74d is a…
wufoo
  • 13,571
  • 12
  • 53
  • 78
456
votes
16 answers

Remove specific commit

I was working with a friend on a project, and he edited a bunch of files that shouldn't have been edited. Somehow I merged his work into mine, either when I pulled it, or when I tried to just pick the specific files out that I wanted. I've been…
Joshua Cheek
  • 30,436
  • 16
  • 74
  • 83
387
votes
4 answers

What Git branching models work for you?

Our company is currently using a simple trunk/release/hotfixes branching model and would like advice on what branching models work best for your company or development process. Workflows / branching models Below are the three main descriptions of…
HiQ CJ
  • 3,406
  • 3
  • 17
  • 11
340
votes
3 answers

Git Cherry-pick vs Merge Workflow

Assuming I am the maintainer of a repo, and I want to pull in changes from a contributor, there are a few possible workflows: I cherry-pick each commit from the remote (in order). In this case git records the commit as unrelated to the remote…
cmcginty
  • 113,384
  • 42
  • 163
  • 163
249
votes
2 answers

How to cherry pick from 1 branch to another

I have 2 branches, master and dev. I am on dev branch and I want to cherry-pick 1 commit from master to dev. So I did $ git cherry-pick be530cec7748e037c665bd5a585e6d9ce11bc8ad Finished one cherry-pick. But when I do git status and gitx, I don't…
michael
  • 106,540
  • 116
  • 246
  • 346
240
votes
2 answers

How does git merge after cherry-pick work?

Let's imagine that we have a master branch. Then we create a newbranch git checkout -b newbranch and make two new commits to newbranch: commit1 and commit2 Then we switch to master and make cherry-pick git checkout master git cherry-pick…
Paul
  • 25,812
  • 38
  • 124
  • 247
172
votes
6 answers

git cherry-pick not working

I'm trying to cherry-pick a commit from master and get it into the current production branch. However, when I execute git cherry-pick , I just get this message: # On branch prod_20110801 # Untracked files: # (use "git add ..." to…
Jay Taylor
  • 13,185
  • 11
  • 60
  • 85
98
votes
2 answers

Consequences of using graft in Mercurial

There've been several questions recently about skipping changes when maintaining release branches in Mercurial. For example: Mercurial: Branch specific changes keep coming back after dummy merge Why are Mercurial backouts in one branch affecting…
Paul S
  • 7,645
  • 2
  • 24
  • 36
95
votes
5 answers

Git cherry-pick syntax and merge branches

So I have done countless cherry picks before and it seems that I must fail at life with this right now, I am trying to cherry pick from one branch to another which should be easy, how ever I get an error about it being a merge but not -m was…
TheWebs
  • 12,470
  • 30
  • 107
  • 211
89
votes
5 answers

cherry-pick a commit and keep original SHA code

I would like to cherry-pick a commit on a fetched remote while keeping it's original SHA commit code (my current branch is based on this remote which I resetted to a previous state).
blameless75
  • 2,148
  • 2
  • 19
  • 14
84
votes
5 answers

How to Conclude a Git Cherry-Pick?

Yesterday I cherry-picked two commits into my main branch, one of them caused merge conflicts and I resolved them, committed and pushed them to origin. Today I am attempting to pull from the server when I get the following error: $ git pull fatal:…
Stunner
  • 12,025
  • 12
  • 86
  • 145
1
2 3
29 30