What is the correct git config for working with GitHub pull requests?

前端 未结 4 2301
情话喂你
情话喂你 2021-02-18 21:44

I\'m aware of How can I check out a GitHub pull request?

While adding fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to .git/config does al

4条回答
  •  执笔经年
    2021-02-18 22:40

    I think I found a solution, and it's unbelievably simple: Order of the lines with fetch = +refs... matters!

    I changed:

    [remote "origin"]
        url = https://github.com/the/repo.git
        fetch = +refs/heads/*:refs/remotes/origin/*
        fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
    

    to:

    [remote "origin"]
        url = https://github.com/the/repo.git
        fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
        fetch = +refs/heads/*:refs/remotes/origin/*
    

    (last two lines swapped)

    Now everything works (fetch, checkout, pull).

    I'm still waiting to see some (un)expected problems with this configuration, but so far so good...

提交回复
热议问题