Jump to content

How to apply patch from one git repository to other one


Recommended Posts

Posted

Figured out.. not very easy, but it's works nice.

// Create a link to repository

git remote add tmp git://github.com/[NAME]/mangos.git

// Fetch sources

git fetch tmp

// Create and switch to tmp branch

git checkout --track -b tmp tmp/master

// Switch back to your master branch which apply patch

git checkout master

// Now type the commit id which you want to get

git cherry-pick 1d7f6138bc1e2bc5ae40d264a48fbe2c5ec035cc

// Now push changes to your server

git push [REPOSITORY] master

// Delete tmp branch

git branch -d tmp

// Delete link to remote branch

git remote rm tmp

Posted

If i'm not mistaken, there's no need to checkout a branch in order to cherry-pick from it, fetch should be enough.

You may also have a look at gitk, after fetching you can setup a view to the remote branch to get a history browser plus the ability to cherry-pick simply by right-clicking on commits.

Posted

In ideal case, there would be something like

git fetch git://github.com/mangos/mangos.git 2cb35a12
git cherry-pick FETCH_HEAD

but, unfortunatelly, git won't eat it that easily.

However there's still noob-proof

git fetch git://github.com/mangos/mangos.git
git cherry-pick 2cb35a12

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use