ignore specific file when running git stash show -p

Viewed 113

I would like to not see the output of package-lock.json when running git stash show -p. Variants of this did not work: g stash show -p -D -- . ':(exclude)package-lock.json'. Thanks

1 Answers

A stash is actually a commit (a merge commit to be precise), pointed to by an actual ref (refs/stash).

So you can use : git show stash, and all options relative to git show itself :

git show stash -- . ':(exclude)package-lock.json'

The "past stashes" (the ones listed in git stash list) are actually entries in the reflog for stash, so you can also work with git show stash@{1}, git show stash@{2}, etc ...

Related