Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git diff for a single file in stash

Tags:

git

git-stash

I know from this answer how to show the diff against a stash.

git stash show -p stash@{1}

But how can I show the diff to a specific file from a stash?

like image 655
Black Avatar asked Jul 19 '18 12:07

Black


People also ask

Can you git stash just one file?

To stash a specific file, use the “git stash push” command and specify the file you want to stash. However, the other tracked files that may be modified in your current working directory are untouched.

How do I pull files from stash?

To retrieve changes out of the stash and apply them to the current branch you're on, you have two options: git stash apply STASH-NAME applies the changes and leaves a copy in the stash. git stash pop STASH-NAME applies the changes and removes the files from the stash.


1 Answers

You can use the diff command with a path:

git diff stash@{1} -- <path>
like image 125
sergej Avatar answered Oct 02 '22 02:10

sergej