Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

How to fetch Github pull request as local branch

📅 2019-May-08 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ github, pull request ⬩ 📚 Archive

Github pull requests are the mechanism by which contributors submit code for review and subsequent merging to a Github branch. It can sometimes be useful to grab a pull request as a branch in your local repository. This can be useful for example to diff with one of your local branches or to merge with one of your local branches.

To fetch a Github pull request, note down its number XYZ. Use this command to fetch it to a new local branch:

$ git fetch origin pull/XYZ/head:new_local_branchname

The pull request is now available locally as the branch new_local_branchname.


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧