Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>1800 INFORMATION's answer is completely correct. As a git noob, though, "use git cherry-pick" wasn't enough for me to figure this out without a bit more digging on the internet so I thought I'd post a more detailed guide in case anyone else is in a similar boat. </p> <p>My use case was wanting to selectively pull changes from someone else's github branch into my own. If you already have a local branch with the changes you only need to do steps 2 and 5-7.</p> <ol> <li><p>Create (if not created) a local branch with the changes you want to bring in.</p> <p><code>$ git branch mybranch &lt;base branch&gt;</code></p></li> <li><p>Switch into it.</p> <p><code>$ git checkout mybranch</code></p></li> <li><p>Pull down the changes you want from the other person's account. If you haven't already you'll want to add them as a remote.</p> <p><code>$ git remote add repos-w-changes &lt;git url&gt;</code></p></li> <li><p>Pull down everything from their branch.</p> <p><code>$ git pull repos-w-changes branch-i-want</code></p></li> <li><p>View the commit logs to see which changes you want:</p> <p><code>$ git log</code> </p></li> <li><p>Switch back to the branch you want to pull the changes into.</p> <p><code>$ git checkout originalbranch</code></p></li> <li><p>Cherry pick your commits, one by one, with the hashes.</p> <p><code>$ git cherry-pick -x hash-of-commit</code></p></li> </ol> <p>Hat tip: <a href="http://www.sourcemage.org/Git_Guide" rel="noreferrer">http://www.sourcemage.org/Git_Guide</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload