I'm working on a huge git repository that is too large to make viewing all remote branches practical. Thus I don't want to use gitk --all
. However, I do like to view other things like my local branches, which I can do with gitk --branches
.
Is there a way to also view any stashes?
Git Stash List. The Git stash list command will pull up a list of your repository's stashes. Git will display all of your stashes and a corresponding stash index. Now, if you wish to view the contents of a specific stash, you can run the Git stash show command followed by stash@ and the desired index.
One you have identified the entry in which you are interested, you likely want to see what is in that stash. This is where the git stash show command comes in. This will display a summary of file changes in the stash.
We can track the stashes and their changes. To see the changes in the file before stash and after stash operation, run the below command: Syntax: $ git stash show.
UPDATE with more concise log command...
You might notice that even with --all
, gitk does not list all stashes. This is because stashes are not distinct refs; they are reflog entries on the single ref stash
.
You can still list multiple stashes, such as by saying
gitk stash@{0} stash@{1}
but only the most recent stash commit will be shown as having a ref pointed at it (which is true; again, the rest are reflog entries).
To automatically include every stash, you can do something like this
gitk `git stash list --format=%H`
This may not help much, though, as a stash's full history would be shown. (And again, only the most recent stash would show with a ref pointed at it, so spotting the others in a long history might not be easy.)
With git log
you could do something like
git log `git rev-parse $(git stash list --format=^%H^)` `git stash list --format=%H`
or, more concisely,
git log `git rev-parse $(git stash list --format=%H^..%H)`
to cut the history short and show only stash commits, but gitk
doesn't seem inclined to honor the ^<commit>
exclusions. Also -n 1
doesn't work because that limits the total number of commits output, not the number per ref (and besides, gitk then decides to be helpful by filling in the history anyway).
So I'm not entirely sure you can do what you want with gitk. But on the other and, the graph that gitk draws would just be a disjointed mess anyway, so maybe the log
approach could be adapted to suit your needs?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With