在git命令行下查看git stash里面文件的内容
本文于1432天之前发表,文中内容可能已经过时。
需求
在使用git的时候往往会保存一些东西,在保存的时候使用的就是git stash,强大的git使得保存修改和恢复修改变的很容易,但有时候时间久了不记得stash里面的内容是什么了。
原英文地址
通过在stackflow里面查找,找到了一个好的方法。其网址是:
http://stackoverflow.com/questions/10725729/git-see-whats-in-a-stash-without-applying-stash
方法
当利用git stash pop弹出来会有些耗费时间,这时可以使用git stash show来查看stash里面保存的内容。
在git bash上可以使用git –help stash来查看git stash命令的用法,当在stash后加show时,官方给出的介绍如下:
show stash
Show the changes recorded in the stash as a diff between the stashed state and its original parent. When no
翻译如下:显示修改在stash状态与原版本之间的不同变化。当没有
总结
也就是使用git stash show -p stash@{1}来查看stash的内容变化。