Re: Git Strange behaviour with remote deleted branch
- From
Paul Smith <paul@mad-scientist.net>
- Date
- Jun 19, 2017, 21:46 UTC
- Message-ID
- <1497908782.6463.8.camel@mad-scientist.net>
- In-Reply-To
- <39331ce5-dbf9-170e-e550-784db10b966f@gmail.com>
On Mon, 2017-06-19 at 23:33 +0200, Reda Lyazidi wrote:
Show 8 quoted lines
> with git I noticed when I removed a remote branch with git push origin > --delete <the branch> > in my clone when I used git branch -a I don't the deleted branch > but my colleagues still see it. > > I tried with two clones in my PC, with the first one delete branch and > the other still sees it > despite git pull .
Normally Git will not remove a remote's branch refs on a fetch (or pull) operation. This is a safety measure, since you might still have a use for that branch (for example to run diff against or similar).
In order to remove branches that have been deleted in your remote, you must use the --prune (or -p) option to git fetch or git pull:
git pull -p
will get rid of them.