Re: Deletion of remote branches

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: Deletion of remote branches

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:54:54

Jens Hausherr [off-list ref] writes:
I came across an issue with deleting remote branches: When deleting a
branch using "git branch ­r ­d <branch>" the branch is deleted and no
longer shown by "git branch ­r".

"git ls-remote --heads" on the other hand still lists the ref for the last
branch commit.

If I delete the branch using "git push origin :<branch>" the branch is
removed completely (i.e. git ls-remote  no longer returns a ref).
All of the above are expected and working as designed.  Remote
tracking branches are local _copies_ of what you have over there at
the remote repository. The latter is the authoritative version, and
you asked "ls-remote" to go over the network to view them.

If you are trying to remove the branches you show to others and
yourself who are observing that remote repository from your local
workstation, you can first "git push origin :<branch>" to remove it
in the remote repository. You can run your next fetch with "--prune"
to get rid of remotes/origin/<branch>, I think.

Re: Deletion of remote branches

From: Philip Oakley <hidden>
Date: 2016-06-15 22:54:54

From: "Junio C Hamano" <redacted>
Jens Hausherr [off-list ref] writes:
quoted
I came across an issue with deleting remote branches: When deleting a
branch using "git branch ­r ­d <branch>" the branch is deleted and no
longer shown by "git branch ­r".

"git ls-remote --heads" on the other hand still lists the ref for the 
last
branch commit.

If I delete the branch using "git push origin :<branch>" the branch 
is
removed completely (i.e. git ls-remote  no longer returns a ref).
All of the above are expected and working as designed.  Remote
tracking branches are local _copies_ of what you have over there at
the remote repository. The latter is the authoritative version, and
you asked "ls-remote" to go over the network to view them.
Is there a definitive naming convention for the two types of 'remote 
branch'?

IIRC (somewhere) the 'tracking' term was to be deprecated, though it is 
still in common use. It is usually only the context that clarifies if it 
is the local or the distant copy/repo.

Distinct names make for less confusion.
If you are trying to remove the branches you show to others and
yourself who are observing that remote repository from your local
workstation, you can first "git push origin :<branch>" to remove it
in the remote repository. You can run your next fetch with "--prune"
to get rid of remotes/origin/<branch>, I think.
Philip 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help