1252748
1252748

Reputation: 15372

View stashed file contents without diff visualization

From git-stash docs on show option (emphasis mine).

Show the changes recorded in the stash entry as a diff between the stashed contents and the commit back when the stash entry was first created.

Is it possible to view the contents of a stash, not as a diff, but rather as raw file contents, in the same manner as git show my-branch:path/to/my/file would?

Upvotes: 4

Views: 662

Answers (2)

David
David

Reputation: 356

Try the command

git show stash@{0}:/path/to/my/file

This shows the contents of the file in file in stash@{0} not as a diff but as the full file.

Upvotes: 7

Madara's Ghost
Madara's Ghost

Reputation: 174957

Unlikely.

Seeing how you could stash on one branch, then move over to another branch and apply the stash there. Stashes are stored as diffs internally by git, and the full file is not preserved or stored alongside the stash.

What might be possible with some arcane voodoo and maybe a sacrificial goat or three, is to give it both a stash and a commit (or branch) and show you how the stash would look applied on the version of the file on that commit. I doubt there's a built-in way to do that though.

Upvotes: -1

Related Questions