Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show all stashes in git log

I would like to see all stashes in git log output. Does anyone know if there is a way to do that?

Edit: I want to see all commits in the log -- including stash commits. I tried the command:

git log --date-order --all 

But it returns only the top most stash. I would like to see commits that represent other stashes too.

like image 458
jbialobr Avatar asked Feb 20 '13 20:02

jbialobr


People also ask

How can I see my stash changes without applying?

git stash show -p stash@{0} --name-only shows just the names of the files (not the contents) in your first stash. @mrgloom If you want to see the stashed changes for a single file, then something like git diff stash@{0}^! -- file. txt will do it.

What is the command to see all the saved stashes in a repository?

Git Stash List (Check the Stored Stashes) To check the stored stashes, run the below command: Syntax: $ git stash list.

Where are git stashes kept?

All are stored in . git/refs/stash . git stash saves stashes indefinitely, and all of them are listed by git stash list . Please note that dropping or clearing the stash will remove it from the stash list, but you might still have unpruned nodes with the right data lying around.


2 Answers

I came here looking to do the same as @jbialobr, I did some more digging after reading the previous answers and came up with the below.

@msmt's answer gives you a log of the stashes, and you can use this to get the hashes to use in the git log.

git reflog show --format="%h" stash gives you just the hashes of all stashes which can then be passed to a git log command such as

git log --date-order --all $(git reflog show --format="%h" stash)

The full command I personally am now using is

git log --oneline --graph --decorate --all $(git reflog show --format="%h" stash)

Tested on git version 2.5.1 on centos

like image 29
SicoAnimal Avatar answered Sep 22 '22 02:09

SicoAnimal


You can show all your stashes with git stash list. Maybe you can write a script to show both git stash list and git log and use it with an alias.

like image 80
mgarciaisaia Avatar answered Sep 20 '22 02:09

mgarciaisaia