从大约一个月前开始,每次我发出 'git pull' 时,我的 'git branch -a' 上都会有一堆 remotes/origin/pr/* 分支,这些分支直接映射到拉取请求的数量曾经在这个 repo 中打开过。执行“git remote prune origin”可以清理它们。
拉之前:
C:\experimental [develop]> git branch -a
* develop
feature/291
master
remotes/origin/HEAD -> origin/master
拉 :
C:\experimental [develop]> git pull
From https://github.com/.../experimental
* [new ref] refs/pull/1/head -> origin/pr/1
* [new ref] refs/pull/10/head -> origin/pr/10
* [new ref] refs/pull/100/head -> origin/pr/100
* [new ref] refs/pull/101/head -> origin/pr/101
* [new ref] refs/pull/102/head -> origin/pr/102
* [new ref] refs/pull/103/head -> origin/pr/103
...
* [new ref] refs/pull/103/head -> origin/pr/382
拉后:
C:\experimental [develop]> git branch -a
* develop
feature/291
master
remotes/origin/HEAD -> origin/master
remotes/origin/pr/1
remotes/origin/pr/10
remotes/origin/pr/100
remotes/origin/pr/101
remotes/origin/pr/102
remotes/origin/pr/103
...
remotes/origin/pr/382
清理 :
C:\experimental [develop]> git remote prune origin
Pruning origin
URL: https://github.com/.../experimental.git
* [pruned] origin/pr/1
* [pruned] origin/pr/10
* [pruned] origin/pr/100
* [pruned] origin/pr/101
* [pruned] origin/pr/102
* [pruned] origin/pr/103
...
* [pruned] origin/pr/382
清理后:
C:\experimental [develop]> git branch -a
* develop
feature/291
master
remotes/origin/HEAD -> origin/master
如何阻止最初的“git pull”将它们拉下来?它只是在大约一个月前才开始发生。
谢谢。