How would I extract a single file (or changes to a file) from a git stash?

前端 未结 9 1603
一生所求
一生所求 2020-11-28 00:14

I\'d like to know if it is possible to extract a single file or diff of a file from a git stash without popping the stash changeset off.

Might anyone be able to prov

9条回答
  •  佛祖请我去吃肉
    2020-11-28 00:41

    $ git checkout stash@{0} -- 
    

    Notes:

    1. Make sure you put space after the "--" and the file name parameter

    2. Replace zero(0) with your specific stash number. To get stash list, use:

      git stash list
      

    Based on Jakub Narębski's answer -- Shorter version

提交回复
热议问题