admin管理员组

文章数量:1127960

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?

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?

Share Improve this question edited Jan 8 at 17:13 Guildenstern 3,7252 gold badges28 silver badges52 bronze badges asked Jan 8 at 16:06 hasdrubalhasdrubal 1,13815 silver badges34 bronze badges 3
  • To satisfy the first condition, just add --branches to your log command. – Romain Valeri Commented Jan 8 at 16:13
  • If you check out one of your branches and run git log --graph, won't you only see your own stuff? – Daniel Walker Commented Jan 8 at 16:15
  • 1 @DanielWalker If so, only current branch history would show up, not the other local branches. – Romain Valeri Commented Jan 8 at 16:17
Add a comment  | 

1 Answer 1

Reset to default 4

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 --ignore-missing $(git for-each-ref --format="%(upstream:short)" refs/heads | sort -u)

(Thanks to Guildenstern for the --ignore-missing suggestion to avoid having to chase stale remote references beforehand.)

本文标签: git loggit log graph smart filter on branchesStack Overflow