How to locally fetch and checkout a pull request
A user may want to locally fetch a Pull Request from Bitbucket Cloud, and check it out to test it out first before deciding to merge it. But what is the URL of the Pull Request? Here's a way to do it.
My original repository: sorcerial
My forked repository: sorcerial-fork
Step 1: Hover your mouse over the branch to get the URL of the Merge request. For my case, it's https://bitbucket.org/gideon_koh/sorcerial-fork/branch/master :
Step 2: Enter into your local repository (mine is "sorcerial" of course) via command line. Modify the URL a little into the format of git fetch <forked_repo_url> <branch> :
In fact, you can even check the diff between sorcerial/master and sorcerial-fork/master (which is now the FETCH_HEAD) by running the command - git diff master FETCH_HEAD:
(Please do take note that FETCH_HEAD is temporary and will most likely change when another git fetch/pull or some other operations is done.)
Step 3: If you want to check the Pull Request out, to experiment on it and to test it out first, simply run the command - git checkout FETCH_HEAD:
Step 4: And when you finally decided to merge the Pull Request, simply click the Merge button on Bitbucket Cloud
And we're done!