Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7526997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:59:31+00:00 2026-05-30T03:59:31+00:00

For some reason, it looks like git cherry-pick pulls in other commits when flies

  • 0

For some reason, it looks like git cherry-pick pulls in other commits when flies have merge conflicts. These go away when we use git mergetool but prevent us from manually editing the merge-conflicted file.

Does anyone know why this happens?

To show what I mean, let’s take a fresh new git 1.7.4 repository with a single file foo:

header

footer

Let’s create a new branch at this point called bar. Back in the master, let’s add three changes to this file in separate commits.

Commit 1:

header

+add something
+
footer

Commit 2:

header

add something

+add something else
+
footer

Commit 3:

header

add something

add something else

+important change!
+
footer

Since this last commit is important, after the fact we decide we want to pull this back to branch bar and git cherry-pick <commit> on that branch.

Unfortunately, this produces an interesting merge conflict in file foo:

header

<<<<<<< HEAD
=======
add something here

add something else here

important change!

>>>>>>> 356ca3c... important change
footer

Note that git mergetool seems to do the right thing and produces this:

header

+important change!
+
footer

Why does the merge-conflicted file contain commits previous to the one we tried to cherry pick?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T03:59:33+00:00Added an answer on May 30, 2026 at 3:59 am

    Git is sceptical and will not do a merge if it does not find the proper edges to what the patch would apply to. The patch would apply to a line number that does not exist. Inspect the patch fro that commit and see that it is applied at a line number that does not make sense. Since it is a cherry-pick, it does not take into consideration how the file got to be that way and that it would be ok to add that entry. Hope that makes sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason it looks like constructor delegation doesn't work in the following snippet:
For some reason, the SOAP response from one of my WebService looks like this:
For some reason, it looks like I cannot pass array of strings as parameter
I have some very simple javascript code that looks like this: var newWindow =
For some reason the Windows command prompt is special in that you have to
This seems like it should be really simple, but for some reason, I'm not
So basically i have a js file which looks like: var player = $("#zen
My git folder looks like: c:\mygits\project1.git\ So I went into that project1.git folder, and
I would like to trigger the js function onClick from button. for some reason
Possible Duplicate: splitting a string i have a string which looks like this: http://pastebin.com/m5508ff19

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.