My "repo" for such things is always bash_completion . So, tab tab is the way that bash becomes a productive tool, so where do all magic things come from?
there is a directory /etc/bash_completion.d/ where extensions remain to complete bash. there should be a git executable, open it and look for something like get_refs (). If you give him a check, you will find that git to describe and git for-each-ref are your friends, try some examples:
General repo:
$ cd /your/git/repo; git branch -a master blaster * brunch lunch remotes/origin/master remotes/origin/develop remotes/github/master
What is my tagged branch?
$ git describe
What are my remotes?
$ git remote origin github
What are the branches on the remotes?
$ git for-each-ref --format="%(refname:short)" refs/remotes origin/master origin/develop github/master
What are my local branches?
$ git branch master blaster * brunch lunch
... more syntax output is output?
$ git for-each-ref --format="%(refname:short)" refs/heads master blaster brunch lunch
What about tags?
$ git for-each-ref --format="%(refname:short)" refs/heads refs/remotes refs/tags master blaster brunch lunch origin/master origin/develop github/master release-0_1 release-0_2 release-1_0
check the "man pages" for these commands, there is much more !!
albfan Sep 16 2018-11-11T00 : 00Z
source share