Are you having trouble checking out someone's pullrequest from a terminal?
Example usage
git clone [email protected]:example/example.git
ghpr someuser:somebranch # Copy this from the PR
It does these things
- Adds someuser as a git remote
- Fetches from someuser remote
- Checks out the branch somebranch
ghpr() {
local user=$(echo ${1:?} | cut -d \: -f1)
local branch=$(echo ${1:?} | cut -d \: -f2)
local repo=$(basename "$PWD")
git remote add "$user" "[email protected]:$user/$repo.git"
git fetch "$user"
git checkout "$branch"
}
Alternatives