force git to accept cherry-pick's changes

I did cherry-pick from a gerrit review in my branch.
In gerrit code review, I have two patch sets and I cherry-picked patch one before, so now I want to do the second patch set, but there are conflicts, how can I force git to accept all changes?
Thanks!

  • Can I use `git subtree split` to maintain a “fork” of a project's subdirectory?
  • Is it better to use git grep than plain grep if we want to search in versioned source code?
  • How to change the license for a project at Github?
  • Git: created new branch from a wrong branch
  • Ubuntu + Git + Netbeans 7 - Do we need to install Git on OS?
  • Git Thinks I Have Unpushed Changes
  • How do I stop git from committing unchanged files?
  • Will tag referencing commits unreachable from any branch be lost?
  • How do I force a merge commit when the branch being merge has been merged and reverted already?
  • How to move Git repositories and minimize downtime
  • How to solve SSL certificate: self signed certificate when cloning repo from github?
  • TortoiseGit, configure automatic merge tool on per-file-basis
  • 2 Solutions collect form web for “force git to accept cherry-pick's changes”

    You can tell it to always prefer the changes of the commit you are cherry-picking:

    git cherry-pick commitish --strategy-option theirs
    

    commitish can be a SHA-1 hash of a commit, or a branch-name for the lastest commit of that branch, branch-name~1 for the commit before that etc.

    If you want to do the reverse, use:

    git cherry-pick commitish --strategy-option ours
    

    The shorthand for --strategy-option is -X (uppercase X).

    you could brute force it with something like this:

    git show cb1e6a:path/to/filename > path/to/filename
    git add path/to/filename
    git commit
    

    but I’m sure there’s an easier way.

    Git Baby is a git and github fan, let's start git clone.