gitgit-log

git log graph smart filter on branches


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:

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 --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.)