How to test pull request locally
You're assigned to review your teammate's code from remote git repository. But rather than just reviewing it directly in Github, you want to run it locally first. Here's how
You’re assigned to review your teammate’s code from remote git repository. But rather than just reviewing it directly in Github, you want to run it locally first. Here’s how you can run any pull request locally first and review it.
Use git fetch
The first step is running git fetch
so we can see get all things that happen remotely on the origin repository.
“The git fetch command downloads commits, files, and refs from a remote repository into your local repo. Fetching is what you do when you want to see what everybody else has been working on” - From Atlassian Git tutorial
We can use git pull
. But consider git fetch
is more safe alternative, since it won’t change our local state just yet.
Switch to any PR you want
To choose any specific branch you want to switch on.
Run git checkout BRANCHANAME
Happy review!