Re: [git-users] remote and remote-tracking branches

2016-03-04 Thread dmgf


On Friday, March 4, 2016 at 12:29:58 PM UTC+1, Konstantin Khomoutov wrote:
>
>
> 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 ` 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. 
>

I understand that the two commands do the same job with a substantial 
difference:
git branch -dr origin/topic-branch can be used when there is only one 
remote-tracking branch to be deleted, while git remote prune  has 
to be used when there is more than one remote-tracking branch, unless I 
wanted to clean up the references one by one.
I take for granted that your command should be used as git remote prune 
origin and not git remote prune origin/topic-branch, and that should be 
called after git branch -d topic-branch and git push origin --delete 
topic-branch.

I also found git fetch --prune at stackoverflow 
probably
 
to be used as git fetch origin --prune.

-- 
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.


Re: [git-users] remote and remote-tracking branches

2016-03-04 Thread Konstantin Khomoutov
On Fri, 4 Mar 2016 03:13:52 -0800 (PST)
dmgf  wrote:

> Are they different objects?
> In the Git user manual 
>  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 ` 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.


[git-users] remote and remote-tracking branches

2016-03-04 Thread dmgf
Are they different objects?
In the Git user manual 
 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.

I usually create a topic/feature branch with: git checkout -b topic-branch
I work on it and push it from time to time to BitBucket with: git push -u 
origin topic-branch
Then when I finished I merge topic-branch to master and push it to BitBucket

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?

-- 
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.