How do I tidy up this Git log

As you rightly say, it's just a stash. Simply say

git stash clear

and the unwanted commits (and no others) will all be gone from the graph.


Why? Well, the basic rule of Git commit persistence is that only reachable commits persist. "Reachable" means that a commit is pointed by a ref name (branch, tag, stash) or is the parent, at some remove, of such a commit. By definition, if you delete the stash pointer that is keeping f187ecb alive, everything from there thru 32e5959 will become unreachable and will vanish from the log output — which is exactly what you wanted. Note that we didn't actually delete any commits — just a name. But those commits will eventually be deleted as well.

Observe also that you could have gotten the same outward effect by saying git log --oneline --graph --decorate --branches. That would have removed the stash from the git log output without changing your repo in any way (i.e. without actually clearing the stash).


In this case your best bet is an interactive rebase. But having merge commits makes that process a bit harder than usual.

git rebase -i 15acb99

Where the commit at the end of the command indicates where to start rewriting your history.

This will pop up an editor with the list of commits between 15acb99 and the last commit in your history.

You can mark the commits you want to keep with k and then squash the commits you want to keep the content of with s but combine the changes with the next commit in line.

From what I can tell you want to squash 6efbd90.