Git: how to use stash -p to stash specific files?

后端 未结 3 1585
刺人心
刺人心 2021-02-01 08:47

I\'m trying to figure out how to stash two specific files among many uncommitted changes.

This very promising answer, Stash only one file out of multiple files that ha

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-01 08:52

    Use git stash -p without arguments. You will then be able to interactively select changes that you want to stash:

    diff --git a/test b/test
    index acbd8ae..662d47a 100644
    --- a/test
    +++ b/test
    @@ -10,6 +10,7 @@ test
    (...)
    +    test
    (...)
    Stash this hunk [y,n,q,a,d,/,e,?]?
    

    Unfortunately it's not possible to select files, only hunks.

提交回复
热议问题