Question

Every time I get fetch from a GitHub repo, a bunch of pull requests are fetched from the remote:

/c/git/myProject>git fetch
From github.com:MyOrganization/myProject
 * [new ref]         refs/pull/1/head -> origin/pr/1
 * [new ref]         refs/pull/10/head -> origin/pr/10
 * [new ref]         refs/pull/11/head -> origin/pr/11
 * [new ref]         refs/pull/12/head -> origin/pr/12
 ...

To get rid of these, I use git remote prune origin or git fetch --prune, but the pull requests come back when I git fetch again. I found some references on the web that enable fetching pull requests locally (add fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to .git/config), but I have not done this.

My coworker does not see this issue and his ~/.gitconfig and .git/config look similar to mine. He uses git under cygwin, and I use git-bash that comes with GitHub for Windows (not the GUI), version 1.0.47.0.

Any ideas why this is happening and how to stop it?

Was it helpful?

Solution

GitHub for Windows's "Git Portable" (a portable MsysGit installation) sets the fetch refspec globally to include pull requests; you can see that by doing a git config --list in git-bash.

You can undo this by removing the respective fetchspec, e.g.:

git config --system --unset remote.origin.fetch
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top