[Very similar to Why do I see a deleted remote branch? , but none of the solutions there worked.]
When forking a repository you may get a branch which you don't want:
$ git branch -a
* master
remotes/origin/master
remotes/origin/merge-brad
Deleting remote branches is a well understood task, so let's do that:
$ git push origin :merge-brad
To git@github.com:l0b0/fake-s3.git
- [deleted] merge-brad
Is it still in the branch list? Yes indeed:
$ git branch -a
* master
remotes/origin/master
remotes/origin/merge-brad
Deleting local references to dead branches is also well known. Let's try the first one :
$ git fetch -p
From github.com:l0b0/fake-s3
* branch master -> FETCH_HEAD
Nope:
$ git branch -a
* master
remotes/origin/master
remotes/origin/merge-brad
Alright, how about the second one:
$ git remote prune origin
Still nope:
$ git branch -a
* master
remotes/origin/master
remotes/origin/merge-brad
And the third:
$ git remote prune origin
$ git branch -a
* master
remotes/origin/master
remotes/origin/merge-brad
The branch list in GitHub doesn't display merge-brad
anymore, but the local copy refuses to acknowledge this, so now what? Is my Git configuration breaking this somehow?
$ git --version
git version 2.8.3
My bad. I'd applied a configuration change to get upstream pull requests without looking closely at the command:
git config remote.origin.fetch "+refs/pull/*/head:refs/remotes/upstream/pr/*"
I had assumed that the result would be that pulls of upstream
would retrieve pull requests, but of course this modifies origin
.
The fix:
$ git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/*
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.