Since I have multiple colleagues in my team pushing out considerable amount of branches, whenever I want to disentangle my own branches I’d like to get a clear overview of only those. In summary I want to use git log --graph --oneline --decorate but only on branches:
- that are my own local branches
- that are specified as the upstream of any of my own local branches
Is there a git command that can realize this?
>Solution :
First, you can have all local branches with --branches.
Then, for the remote branches your local branches are tracking, you’ll have to do a bit of mapping through git for-each-ref for instance:
git log --graph --branches $(git for-each-ref --format="%(upstream:short)" refs/heads | sort -u)
(But beware of missing remote references. If you have local branches pointing to deleted remote refs, this will fail with a missing reference error.)