/.git/config
[remote "origin"]
url = ssh://[email protected]:7999/brikks/brikks.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
fetch = +refs/pull-requests/*/merge:refs/remotes/origin/pull-requests-merge/*
Every now or then I find myself looking for a way to checkout a pull request on my computer, a cool thing is that they are available directly from stash, I'll focus on stash here but github will work in a similar way. By adding:
fetch = +refs/pull-requests/*/from:refs/remotes/origin/pull-requests/*
you'll be will be able to checkout any pull request by writing git checkout pull-request/1337
When we hit the merge button stash we'll merge the pull request to a target branch e.g. develop, master the problem is that it's possible that the merged code won't build e.g. if another branch sneaks in before and change a method name. By adding:
fetch = +refs/pull-requests/*/merge:refs/remotes/origin/pull-requests-merge/*
you'll be able to see how the result would look like after the merge to develop.
I'm also writing this part since I struggling with feature branches vs pull requests. They are pretty much the same but our feature branches are living in the same repo as master and develop and build directly from start. Puil requests on the other hand can be located everywhere making it possible to rewrite the history for the pull request.