Reputation: 56
Is there any sane overview for ALL branches of my local repository and all of its remotes and their relationships? (either built in or via 3rd party tools or via command line "hacks"/scripts)
Example:
Local Loc. track. Remote track. Remote
--------------------------------------------------------------
mynewtest
development ---[0↑0↓]---> origin/development --> development [origin]
origin/testing --> testing [origin]
version0.5 --[45↑0↓]---> origin/version0.5
origin/version0.6
version1.0 (-[1↑854↓]->) origin/version1.0 --> version1.0 [origin]
UITests [origin]
algoContestMia --[12↑4↓]---> mia/algo --> algo [mia]
algoContestBen ---[4↑8↓]---> ben/newalgo --> newalgo [ben]
algoContestMyA ---[7↑0↓]---> my/algoContest --> algoContest [my]
algoContestMyB --[14↑10↓]--> my/algoContest --> algoContest [my]
my/UITests --> UITests [my]
version1.0
is an example for showing matching
branches, that are not set as upstream but via matching names configured for pushs (not pulls)
Upvotes: 1
Views: 112
Reputation: 60275
To get your local repo up to date, use git fetch
. To see details on where that got you, you can use git branch -avv
. To clean out stale tracking refs, use git fetch --prune
.
If you want a report formatted exactly the way you've shown here look at the --format
option on git for-each-ref
, getting everything juuuust the way you want it is five-liner territory.
The workflow you're describing, where your only notice of branches you care about appearing and disappearing in multiple remotes is their appearance and disappearance, is remarkably chaotic. My own experience is of course limited, but I've never seen any work environment like that. Nonetheless, you can get what you need to wrangle this from git, you'll just have to collate it yourself.
git ls-remote
shows all or a selection of refs from any arbitrary path or url (or remote name, which is just local-config shorthand for a path or url and a gaggle of command defaults). git for-each-ref
is git ls-remote
for local repos, it can also show you stuff from the local config about the refs, and can print arbitrarily-formatted (e.g. command sequences) text for each.
So for instance you can
for f in `git remote`; do git ls-remote -h $f | sed s,^,$f\\t,; done
and a pair of git for-each-ref
s, one for refs/heads, another for refs/remotes, to get the local sets. See the git for-each-ref
docs to see what it'll tell you, I'd probably do this with just plain unix join
s of the three datasets aka tables on remote name, or maybe something with sqlite if it got hairy.
Upvotes: 2