I have five files that have been changed: 1-3 need to be in a single commit, while 4 and 5 need to be different commits entirely, so I need 3 separate commits in all. How do I use git stash
to accomplish the following:
commit1:
file1
file2
file3
commit2:
file4
commit3:
file5
without losing any of my changes? Thanks!
If I'm reading your question correctly, you don't need to use git stash
at all...
You could just add them and commit them separately:
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"