Pergunta

I am trying to check out a pull request to my local development box so that I can run some tests on it. I found some reference to doing this here, but I can't get it to work correctly.

git fetch refs/pull-requests/$PR_NO/from:$LOCAL_BRANCH

I am not sure what I should replace $LOCAL_BRANCH with. I have tried 'master' but I get the exception bellow.

$ git fetch origin refs/pull-requests/30/from:master
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository

What is the correct way to do this?

Foi útil?

Solução

So $LOCAL_BRANCH can be (almost) anything you want - it's going to create a new branch of that name. So you might want to call it 'pr_30_from' if you like. I'm assuming you were checked out on the master branch, which is why you get that error - that's about the one name you can't use.

Let me know if that works. Charles

PS. Just as a word of warning, you can only fetch from open pull requests (at least in Stash 2.9+). If '30' has been merged/declined you will no longer be able to fetch from it.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top