Monday, November 6, 2017

checkout a github Pull Request locally


So, you have cloned a repo and working on it.

You have a Pull Request(PR) in *upstream* repo which you wish to clone locally.


So, you do the below:

$ git fetch upstream pull/195/head:my_testing

remote: Counting objects: 32, done.
remote: Total 32 (delta 8), reused 8 (delta 8), pack-reused 24
Unpacking objects: 100% (32/32), done.
From https://github.com/gluster/gluster-kubernetes
 * [new ref]         refs/pull/195/head -> my_testing

Here,
upstream -> branch from which you actually forked.
195 -> PR number
my_testing -> new branch name


$ git checkout my_testing
Switched to branch 'my_testing'


PS: If you have not forked but cloned the original repo itself, use "origin" instead of "upstream".
Use git config -l  to  see origin, upstream branches.



No comments:

Post a Comment