How can I diff my current working copy against a stash?
My use case: my working copy already contains a subset of the changes in my stash@{0}
, but I don't want to apply all the changes in stash@{0}
. I want to do a diff to help determine which desirable changes in stash@{0}
are still missing from my working copy.
If you made two stashes, then just call git stash pop twice. As opposed to git stash apply , pop applies and removes the latest stash. You can also reference a specific stash, e.g.
git stash temporarily shelves (or stashes) changes you've made to your working copy so you can work on something else, and then come back and re-apply them later on.
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.
If it was your most recent stash, git diff stash@{0}
will do it. If not, you can use git stash list
to get the index of which stash you want to compare to.
To see the difference between the actual working copy and the stash you would need to commit it first. You could then rollback the commit.
git add -A <- Add all the files git commit -m "temp" <- commit them git diff stash@{0}..HEAD <- diff the commit with your stash git reset HEAD~ <- roll your commit back
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