Deleting a branch

9 views
Skip to first unread message

Peter Kronenberg

unread,
Jun 29, 2021, 1:35:51 PMJun 29
to smar...@googlegroups.com
When I delete a branch, I get this pop-up:

image.png

What is the difference between not checking either of the boxes vs checking just the first box?

Moshe Katz

unread,
Jun 29, 2021, 1:42:18 PMJun 29
to smar...@googlegroups.com
Remember that Git on your machine keeps a local list of what branches are available on the server.

The first checkbox says "delete my local record of the existence of the remote branch but do not delete it from the server".
The second checkbox says "also tell the server to delete its record of that branch."
If you only check the first box and then do a pull/fetch, the local pointer to the remote branch will be recreated.

Moshe



--
You received this message because you are subscribed to the Google Groups "SmartGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smartgit+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smartgit/CACXSX_2z%2BcY9ke-H45VT34Q5sQ9FPVnteo%2BGnLXHn2Upz6NXPA%40mail.gmail.com.

syntevo Support

unread,
Jun 29, 2021, 2:06:21 PMJun 29
to smar...@googlegroups.com
Moshe, I couldn't have written it more clear. Do you think this UI offers room for improvements?

--
Best regards,
Thomas Singer
syntevo GmbH
http://www.syntevo.com


06/29/2021 19:42 - Moshe Katz wrote:

> Remember that Git on your machine keeps a local list of what branches are
> available on the server.
>
> The first checkbox says "delete my *local* record of the existence of the
> remote branch *but do not delete it from the server*".
> The second checkbox says "also *tell the server* to delete its record of
> that branch."
> If you only check the first box and then do a pull/fetch, the local pointer
> to the remote branch will be recreated.
>
> Moshe
>
>
>
> On Tue, Jun 29, 2021 at 1:35 PM Peter Kronenberg <pakron...@gmail.com>
> wrote:
>
> > When I delete a branch, I get this pop-up:
> >
> > [image: image.png]
> >
> > What is the difference between not checking either of the boxes vs
> > checking just the first box?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "SmartGit" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to smartgit+u...@googlegroups.com.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/smartgit/CACXSX_2z%2BcY9ke-H45VT34Q5sQ9FPVnteo%2BGnLXHn2Upz6NXPA%40mail.gmail.com
> > <https://groups.google.com/d/msgid/smartgit/CACXSX_2z%2BcY9ke-H45VT34Q5sQ9FPVnteo%2BGnLXHn2Upz6NXPA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "SmartGit" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
> smartgit+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/smartgit/CALJwmGCVmVTZqZjWwgNiVEyhwcs%2BicZbqv68agziq-CfaiuYJw%40mail.gmail.com.
>

Peter Kronenberg

unread,
Jun 29, 2021, 3:08:19 PMJun 29
to smar...@googlegroups.com
Right, I think I get that.  But I can also leave *both* boxes unchecked and it looks like it deletes from my local as well.
So what's the difference between not checking either of them or just checking the 1st one

Moshe Katz

unread,
Jun 29, 2021, 3:32:38 PMJun 29
to smar...@googlegroups.com
Peter,

There are three branch references that are relevant here:
  1. Your local branch itself, in this case named 'nexus-service-auth-1.0.0'
  2. Your local reference to the remote branch, in this case named 'origin/nexus-service-auth-1.0.0'
  3. The server's copy of the branch, also named 'nexus-service-auth-1.0.0'
When your local repository is in sync with the server, all three of these references are all pointing to the same commit.
When you do a local commit, that moves your local reference to the new commit. When you 'push', that updates both #2 and #3 (assuming there is no conflict on the server).
If someone else does a push to that branch, that only updates #3. When you do a 'fetch' (but not a 'pull'), that updates #2 to be the same as #3, but does not update #1.

So to rephrase my earlier explanation, in the dialog box you asked about:
  • When you delete the branch (without any checkboxes), you are only deleting reference #1.
  • When you click the first checkbox, you are also deleting reference #2. (This does not affect the content on the server itself.)
  • When you click the second checkbox, you are also sending a message to the server to delete reference #3.

Moshe



Moshe Katz

unread,
Jun 29, 2021, 3:37:03 PMJun 29
to smar...@googlegroups.com
Thomas,

I think the UI is fine the way it is. I think this happens to be one of the most difficult concepts in git (the only harder one is rebasing), because I am constantly explaining it to my coworkers over and over again.

Moshe


Phil Beauvoir

unread,
Jun 30, 2021, 4:23:22 AMJun 30
to SmartGit
Hi Thomas, the UI is fine. Please don't change it. Once one understands local, tracked and online branches, it all becomes clear.

Phil
Reply all
Reply to author
Forward
0 new messages