Cherry-picking remote branches

December 13, 2011

linux

I’ve create a little tool (actually an XSLT file) that helps to write RFCs. Browsing my github repo I found two different forks. And browsing those forks, I saw some commits I wanted to have.

But how do you merge a commit from a forked git repository? Turns out it is not that difficult.

The commit I want has the hash 5a11e88ddbef4ce7513aae93bdcd377449f45efb.

The steps:

  • Create a remote branch:

    git remote add hamnis https://github.com/hamnis/pandoc2rfc
    
  • Fetch the contents of it:

    git fetch hamnis
    
  • Cherry-pick the commit you need:

    git cherry-pick -c 5a11e88ddbef4ce7513aae93bdcd377449f45efb
    [master 7501f13] transform.xsl: Supporting the output from pandoc 1.8.2.1:  
    * table/title 
    instead of table/caption  
    * table/tgroup/thead/row/entry instead of table/thead/tr/th  
    * table/tgroup/tbody/row/entry instead of table/tbody/tr/td
     Author: Trygve Laugstøl <trygvis@inamo.no>
     1 files changed, 3 insertions(+), 3 deletions(-)
    

Voila.

None