On Fri, 4 Mar 2016 03:13:52 -0800 (PST)
dmgf <ml.maili...@gmail.com> wrote:

> Are they different objects?
> In the Git user manual 
> <https://git-scm.com/docs/user-manual.html#what-is-a-branch> it is
> written that "your local repository keeps branches which track each
> of those remote branches, called remote-tracking branches, which you
> can view using the -r option to git-branch.
> 
> Overall If I am not wrong there should be local branches and 
> remote-tracking branches in my local repository, and remote branches
> at BitBucket or GitHub for instance.

Yes, that is correct.
I'd only note that calling branches in the remote repos "remote" is
just a matter of convenience: to those remote repos, these branches are
pretty much local.

Your local repository indeed contain only normal (local) branches
(which are updated solely by you) and remote-tracking branches which
are updated by `git fetch`.

[...]
> If in the end the work on my new feature was completed I would
> probably want to remove my local and remote topic-branch.
> What then am I supposed to do? Delete only my local and remote branch
> or also my remote-tracking branch?
> 
> In other words, I should use all the following three commands:
> 
> git branch -d topic-branch
> git push origin --delete topic-branch
> git branch -dr origin/topic-branch
>
> or only two of them are necessary?

It depends.  If you really want to wipe out any mentions of that branch,
the third command is necessary too: the way remote-tracking branches
work is somewhat asymmetrical to normal branches in that if a branch is
deleted in a remote repo you're tracking, the next `git fetch` against
that remote repo won't delete the matching remote-tracking branch.
So there are two ways to deal with such branches: one is that you
presented and another one is `git remote prune <remotename>` which
would reach for the identified remote repo, grab the list of branches
it has and make sure all your remote-tracking branches for that remote
which no longer exist there are deleted.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to