Questions tagged [git-cherry-pick]

This command applies the changes introduced by some existing commits.

Given one or more existing commits, apply the change each one introduces, recording a new commit for each. This requires your working tree to be clean (no modifications from the HEAD commit).

When it is not obvious how to apply a change, the following happens:

  • The current branch and HEAD pointer stay at the last commit successfully made.

  • The CHERRY_PICK_HEAD ref is set to point at the commit that introduced the change that is difficult to apply.

  • Paths in which the change applied cleanly are updated both in the index file and in your working tree.

  • For conflicting paths, the index file records up to three versions, as described in the "TRUE MERGE" section of git-merge(1). The working tree files will include a description of the conflict bracketed by the usual conflict markers <<<<<<< and >>>>>>>.

  • No other modifications are made.

See git-merge for some hints on resolving such conflicts.

Links

376 questions
18
votes
1 answer

Gitlab: Sorry, we cannot cherry-pick this merge request automatically

I got following error in the Gitlab: Sorry, we cannot cherry-pick this merge request automatically. This merge request may already have been cherry picked, or a more recent commit may have updated some of its content. I have branch X from which I…
Mike
  • 541
  • 1
  • 4
  • 18
18
votes
3 answers

Git - how to automatically resolve "deleted by us" conflict when cherry-picking

I run the following command: git cherry-pick SHA --strategy-option theirs and get a conflict like this waiting for manual resolution: deleted by us: SOME_FILE Is there a way to make git automatically resolve such conflicts by adding files deleted…
Legat
  • 1,379
  • 3
  • 11
  • 20
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
1 answer

Can 'git log' ignore certain commits based on commit message?

I'm using git log in order to generate a diff between two branches. The exact command I'm using is: git log --left-right --graph --cherry-pick --oneline sourceBranch...targetBranch What I'm wondering is if I can exclude some of the log entries…
AWT
  • 3,657
  • 5
  • 32
  • 60
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
2 answers

How to cherry pick commits after they've been reverted?

I was working on my feature branch and after review, merged it into development to be deployed. Later, a coworker decided to do a release and merged his and mine into master. While deploying he realized his code was buggy and reverted master. In our…
Gina
  • 570
  • 2
  • 5
  • 20
16
votes
1 answer

What is the Difference Between Git Cherry-Pick and Git Revert?

I still find the behavior of git revert somewhat confusing. After significant pain and misunderstanding, I learnt that git revert negates a particular commit rather than reverting to that commit. I have not used git cherry-pick so far. Can you…
haziz
  • 12,994
  • 16
  • 54
  • 75
15
votes
4 answers

Why does git show a conflict between two apparently identical added files?

I have a project that was started in TFS, then moved to Git. Unfortunately, the guy who moved it to Git just checked in the current files instead of using git-tfs. I'm trying to rebase his new commits in Git on top of the commits I pulled from TFS…
Ryan Lundy
  • 204,559
  • 37
  • 180
  • 211
14
votes
3 answers

Cherry-pick Commit from a different repo

I was trying to cherrypick this commits https://github.com/AICP/frameworks_base/commit/59ebfb7146616e57c15469d7ea85c4362c2fab3c https://github.com/AICP/frameworks_base/commit/e24d0c250b4f80618f4b6064ad21d9c913890899 from…
Gopinaidu
  • 143
  • 1
  • 1
  • 4
13
votes
2 answers

Cherrypick commit orders

That might be a naive git question but here it is: Before doing a pull-request, I usually create a new branch from the latest commits in the upstream and cherry-pick the important commits from my development branch. Then make a pull-request from my…
systemsfault
  • 15,207
  • 12
  • 59
  • 66
12
votes
2 answers

Why extra changes in git cherry-pick conflict?

For git cherry-pick resulting in a conflict, why does Git suggest more changes than just from the given commit? Example: -bash-4.2$ git init Initialized empty Git repository in /home/pfusik/cp-so/.git/ -bash-4.2$ echo one >f -bash-4.2$ git add…
0xF
  • 3,214
  • 1
  • 25
  • 29
11
votes
1 answer

Why would git cherry-pick produce fewer conflicts than git rebase?

I rebase often. Occasionally the rebase is particularly problematic (lots of merge conflicts) and my solution in such cases is to cherry-pick the individual commits onto master branch. I do this because nearly every time I do, the number of…
sfletche
  • 47,248
  • 30
  • 103
  • 119
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
2 answers

Git cherry pick a commit and place it below

From what I know, by default the cherry-pick command takes a commit and places it on top of the current branch. Is it possible to cherry-pick a commit in Git and place it below the current commit?
nyarlathotep108
  • 5,275
  • 2
  • 26
  • 64
1 2
3
25 26