How to apply a pull request on GitHub with TortoiseGit

· January 24, 2011

I am loving GitHub! Especially the social collaboration that occur around the projects and code. If you never committed code to a OSS project try it – it’s a exhilarating feeling. And just imaging the other side of the coin – to get suggestions and improvements from other people sent to you! That’s the good news – the bad news (for me at least) is the Git is something else. It’s great but it takes some getting used to. I’m not there yet. For example the preferred way seems to be command line, and I haven’t got used to that yet. There are some GUIs available that help people like me to overcome the abyss, the most well known is TortoiseGit. That was the tool finally got me to understand, use and love GitHub. But when I got a pull request sent to me I hit a brick wall. At the bottom of the page for the a pull request in GitHub there are some excellent instructions for how to pull the request into your main branch. But I couldn’t translate that into what to do in TortoiseGit. And that’s one of the problems of a GUI on top of another system – the nomenclature is not always the same and you will run into problems. So here is ONE way to do it. I’m sure there is another better way but this works.

  1. Go to the pull request on GitHub (for example https://github.com/marcusoftnet/KanbanBoards/pull/1)
  2. Add the extension “.patch” to the URL and download that file to your disk somewhere
  3. Right-click the folder with your Git local repository (for example C:\Dev\MyProject) and select Git Sync… from TortoiseGit – which opens this window tortoise git sync window
  4. From the window select Apply patch
  5. Choose Add from the next dialog and add the file you save in step 2 above add patch
  6. Choose Apply
  7. Now commit the patch to your master
  8. Optionally push that change to a remote master

I know that I probably will be frowned upon by command liners out there but this is a way I got around a serious problem. It took me about 2 hours to find and apply this solution which is enough time for not want to have to do it again.

Twitter, Facebook