Git show all branches (but not stashes) in log

cYrus picture cYrus · Feb 24, 2012 · Viewed 24k times · Source

I have a Git alias that expands to:

git log --graph --oneline --all --decorate

According to man git log there are a couple of suspicious options: --not and --branches; but I can't make it work properly.

How should I edit that to hide the stashes?


FYI: as per the accepted question and comment my .gitconfig alias now looks like this:

[alias]
    l = log --branches --remotes --tags --graph --oneline --decorate --notes HEAD

Answer

Andrew Marshall picture Andrew Marshall · Feb 24, 2012

Instead of doing --all and then trying to filter out the stashes, don't ever include them in the first place:

git log --branches --remotes --tags --graph --oneline --decorate

The main problem that arises from trying to filter them out afterwards is that if the stash is the latest commit on that branch (because even though it's not the head of the branch, it's still the most recent descendant of it), it can actually filter out the entire branch from the log, which isn't what you want.