Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
244 views
in Technique[技术] by (71.8m points)

Is it possible to preview stash contents in git?

I often put work away for later, then other stuff comes along, and a few weeks later, I want to inspect the stash, and find out what changes it would make if I applied it to working tree in its current state.

I know I can do a git diff on the stash, but this shows me all the differences between the working tree and the stash, whereas I'm just interested to know what the stash apply is going to change.

How can I do this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

git stash show will show you the files that changed in your most recent stash. You can add the -p option to show the diff.

git stash show -p

If the stash you are interested in is not the most recent one, then add the name of the stash to the end of the command:

git stash show -p stash@{2}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...