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

前端 未结 9 1576
一生所求
一生所求 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:30

    Use the following to apply the changes to a file in a stash to your working tree.

    git diff stash^! --  | git apply
    

    This is generally better than using git checkout because you won't lose any changes you made to file since you created the stash.

提交回复
热议问题