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

  • Home
  • SEARCH
  • 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 362015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T13:12:16+00:00 2026-05-12T13:12:16+00:00

Take this scenario: I decide to ‘fork’ a codebase on github.com, and start doing

  • 0

Take this scenario:

  1. I decide to ‘fork’ a codebase on github.com, and start doing my routine: Edit – Commit – Push; aka hack hack hack.
  2. After I made some changes, I see some changes another person has made on the same project, and I like them!
  3. I decide I want to merge them into mine. Problem is, I only want a ‘portion’ of one particular commit, out of several commits he has made.

What would be the most efficient method of getting these select amount of changes, merged into my ‘fork’?

  • 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-12T13:12:16+00:00Added an answer on May 12, 2026 at 1:12 pm

    After trolling the waves of the IRC world, someone gave a great solution:

    git cherry-pick SHA1 --no-commit
    git add --patch
    

    Hopefully that helps anyone else with the same question!

    EDIT: OK, maybe it isn’t quite that simple. Here are the full steps:

    1. First you have to be in your repository, do the necessary cd-ing to get to your working directory.

    2. You now need to add the remote branch, and then fetch it. Do this by:

      git remote add someUser git://github.com/someUser/someRepo.git

      git fetch someUser

    3. You can now run commands such as git log someUser/master to find the commit SHA1 you want to merge in ‘partially’.

    4. Once you have the SHA, you can now run:

      git cherry-pick -n SHA1

      where SHA1 is the commit SHA, duh!

    5. There quite possibly will be conflicts, depending how old the commit is, and how often that particular area of the project changes. Sorry, but you have to manually resolve these with your trusty editor. So pull out VIM, or whatever else you use, and hack away at the conflicts until you get to the stage where you like the changes.

    6. You now have to reset the index to the HEAD revision, then you can then use the trusty GIT add --patch command to pick and choose what changes you want:

      git reset HEAD

      git add --patch or git add -p

    7. Yay! Commit time:

      git commit -m "I merged a select amount of changes"

    8. To clean up the mess (The stuff you said no to in git add --patch) and only keep the selected changes in your working repository, run:

      git reset --hard HEAD

      Apparently git checkout -f is another option as well.

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

Sidebar

Ask A Question

Stats

  • Questions 220k
  • Answers 220k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The caveat is, you don't have an IP address, you… May 13, 2026 at 12:01 am
  • Editorial Team
    Editorial Team added an answer I've never used the Ribbon before, but i made a… May 13, 2026 at 12:01 am
  • Editorial Team
    Editorial Team added an answer You might be looking for IgnoreDataMemberAttribute. May 13, 2026 at 12:01 am

Related Questions

Take this scenario: I decide to 'fork' a codebase on github.com, and start doing
We are trying to decide the best decision to maintain state across our web
I am having a WPF dataentry form which has got 3 comboboxes which needs
I have a situation where I'm starting a number of objects that, when they
I accumulated a quite a lot of data in a raw form (csv and

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.