[tor-dev] Moving ownership to TheTorProject

Andreas Krey a.krey at gmx.de
Tue Apr 1 19:15:11 UTC 2014


On Tue, 01 Apr 2014 12:02:23 +0000, Zack Weinberg wrote:
...
> That's not the issue; the issue is that I am unaware of any good way to
> tell git to pull or push *all* branches that exist in a particular
> remote.  Your example
> 
> > [remote "origin"]
> >         url = git at github.com:zackw/stegotorus.git
> >         fetch = +refs/heads/*:refs/remotes/origin/*
> >         pushurl = zackw at gitweb.torproject.org/stegotorus.git
> 
> would IIUC pull/push only those branches that *already exist* locally.

No, a 'git fetch --prune' will fetch all (local[1]) branches on the remote
repo and store them as remotes/origin/*. You can see those branches with
'git branch -a'. The --prune makes a local remotes/origin/* branch
disappear when the respective branch in the remote vanished.

> In fact, I don't even know how to get it to *list* all the branches that
> exist in a remote, whether or not they are tracked in the local copy;

There are two kind of 'tracking'. One are the 'tracking branches,
i.e. the remotes/origin/* branches that mirror ('track') the state
of the remote repo. The other is the branch-specific setting for
local branches that link a local branch to a specific branch on
the remote.

> when I've had to do this (once before, and never again until I learn a
> better way) I wound up manually copying and pasting from the branch list
> on gitweb for the remote in question.

If you actually want to push all local branches to a remote:

  git push remotename 'refs/heads/*:refs/heads/*'

For that, none of those branches should be the current branch in the
remote repository. Apply --force or --prune with care and understanding.

Andreas

[1] 'local branches': Those that aren't remote tracking branches,
    but show up in 'git branch' without '-a'.

-- 
"Totally trivial. Famous last words."
From: Linus Torvalds <torvalds@*.org>
Date: Fri, 22 Jan 2010 07:29:21 -0800


More information about the tor-dev mailing list