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
2
votes
1 answer

Cherry-pick binary merge conflict with text files

When I cherry-pick from another repo I often get binary-conflict like this: `$ git cherry-pick -e 75fa3f Performing inexact rename detection: 97% (636400/652525), done. warning: Cannot merge binary files: src/Pippo.ext (HEAD:src/Pippo.ext vs.…
Samuele
  • 21
  • 1
2
votes
1 answer

Command executed via pexpect not taking effect

I am trying to cherry-pick gerrit reviews using a python script. I already have the string required to cherry-pick a review. I have used pexpect to automate the password input step. Here is an example. For each review I have to execute the following…
2
votes
1 answer

The previous cherry-pick is now empty when not cherry-picking

I am trying to drop a list of commits by using git rebase -i HEAD~19. I have successfully used this method in the past, but when I try running and then quitting vim without any changes(:q!) I get this error: The previous cherry-pick is now empty,…
Jamie
  • 1,909
  • 3
  • 22
  • 47
2
votes
1 answer

How do I find other commits that touch the same code as a given commit?

I'm looking to cherry-pick some code. The code was squashed-on-merge, so I know it's just that one commit to get the feature or bugfix that I desire. However, I'm worried that this commit may introduce its own bugs. Presumably, those bugs were…
Pxtl
  • 880
  • 8
  • 18
2
votes
1 answer

git shortcut to rebase from another branch onto the current branch

I want to rebase and checkout a branch onto the current branch without checking it out first. This saves time checkout out an old repository state and recompiling the files it touches. For example, I have this: A -> B -> C (HEAD -> main) \ D -> E…
jozxyqk
  • 16,424
  • 12
  • 91
  • 180
2
votes
2 answers

Cannot cherry-pick commit changing not-existing file

I'm wondering why git doesn't allow cherry-picking a commit that introduces changes to a file that doesn't exist. My understanding is that a commit represents a full snapshot of working directory. So cherry-picking a commit containing file that…
mzakrze
  • 53
  • 3
2
votes
1 answer

How do I apply changes from a specific Git commit somewhere else in the commit tree?

Say I have two branches in a git repo 'master' and 'feature'. The two branches have diverged from some point. Now I want to take the exact changes to 'script.py' from commit '0123456789abcdef' on the 'feature' branch and apply those changes to the…
Thomas Arildsen
  • 1,079
  • 2
  • 14
  • 31
2
votes
3 answers

Why does Git know it can cherry-pick a reverted commit?

In a branch, say, there are 3 commits: A <- B <- C. If I cherry-pick B directly (Test A), Git says: The previous cherry-pick is now empty, possibly due to conflict resolution. If you wish to commit it anyway, use: git commit --allow-empty I…
xnervwang
  • 125
  • 1
  • 8
2
votes
1 answer

Why does a cherry-pick cause git merge to discard part of my commit?

So I'm trying to understand why when I git merge master into a branch, I lose some, but not all of my changes in a commit. It seems to do with a cherry-pick commit on my branch. Here's how to reproduce: init a repo with an initial commit Add a line…
moxie1111
  • 21
  • 2
2
votes
1 answer

How to cherry-pick commit correctly

I have to cherry-pick commit to issue-7044 from issue-7044a branch and when I run git cherry-pick I receive: On branch issue-7044 Your branch is up to date with 'origin/issue-7044'. You are currently cherry-picking commit . …
2
votes
4 answers

Extracting git history for part of a git repo to create a git submodule -- cherry-pick?

A similar question, How to cherry-pick multiple commits, assumes that the commits are consecutive. I have a module that I downloaded as a tarball. I've included it in my main project's git repo and made changes to it. These changes are interspersed…
idbrii
  • 10,975
  • 5
  • 66
  • 107
2
votes
2 answers

How to push a commit using git cherry-pick with a different commit comment

I have used git cherry-pick to push a commit from branch a to branch b . git checkout branch b git cherry-pick commit-hash Which worked fine but I couldn't find a way to update the push comment. Whatever comment was provided earlier for branch a…
JavaSeeker
  • 53
  • 1
  • 1
  • 8
2
votes
1 answer

Howto share new git branches between two different branch trees?

I have a repo where i have two main branches (one is a custom version of the standard product and the other is the standard). They share like 90-95% of the code, but there are vital differences on them. What is the best way to create new features…
merger
  • 698
  • 1
  • 10
  • 28
2
votes
1 answer

How can I filter `git cherry` output?

I ran the below command, git cherry main dev The output for above command is like, + d86f3e25f42b546af008b774c2649d585cc48310 - 1d90a12b91b461f857eb373d69372a2864b9e651 + 4194aa6d206225242e881d2128e59981b8826eeb I want to see only commits which…
Sazzad Hissain Khan
  • 37,929
  • 33
  • 189
  • 256
2
votes
2 answers

force partial git cherry-pick?

When I'm doing a git cherry-pick and there's a conflict, git stops short of making the commit and allows me to resolve the conflict. Is there a way to force this stop even if there are no conflicts? The reason I want to do that is that I have a…
shoosh
  • 76,898
  • 55
  • 205
  • 325