如何为多次提交"git stash"更改?

DrS*_*ork 2 git git-stash

我有五个文件已被更改:1-3需要在一个提交中,而4和5需要完全不同的提交,所以我需要3个单独的提交.我如何使用git stash来完成以下任务:

commit1:
  file1
  file2
  file3
commit2:
  file4
commit3:
  file5
Run Code Online (Sandbox Code Playgroud)

没有丢失任何变化?谢谢!

CDu*_*Dub 6

如果我正确地阅读你的问题,你根本不需要使用git stash......

您可以添加它们并单独提交它们:

git add file1 file2 file3
git commit -m "first message"
git add file4
git commit -m "second message"
git add file5
git commit -m "third message"
Run Code Online (Sandbox Code Playgroud)