top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Git Strange behaviour with remote deleted branch

0 votes

with git I noticed when I removed a remote branch with git push origin --delete 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 .

I use git version 2.9.4

posted Jun 19, 2017 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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.

answer Jun 19, 2017 by Rameshwar
Similar Questions
+1 vote

I've been trying to put my filesystem for a very small busybox-based distro into a git-repository. And with success. The only strange thing I can not get my head around is the following :

When making a compressed tarball from the files from the repository (after clone/checkout) I get a very much larger tar.gz-file. Size goes up from 16M to 21M (!?)

+1 vote

I wanted to avoid push if any of the files is deleted from the local git clone area. Can anyone please help me with that?

I am using Stash for repository management.

0 votes

Is there a way to prevent reflog deletion when the branch is deleted? The last entry could simply be a line where the second SHA is all 0's.