0

I have a huge commit and I decided to split it into two commits. So I want to make somekind of git reset for a few files in first commit and still have my changes of theese files in git index to be able to make a next commit. Is there a way to do it?

Paul
  • 6,641
  • 8
  • 41
  • 56

2 Answers2

0

You can just unstage the files you want, do your commit, and then restage the files you want and do the second commit.

You could always do an interactive stage, see https://git-scm.com/book/en/v2/Git-Tools-Interactive-Staging

David Neiss
  • 8,161
  • 2
  • 20
  • 21
0

First unwind the stack one commit keeping everything in the index:

git reset --soft HEAD~

Now unstage the files you don't want until the next commit:

git reset -- next.commit.file.txt

Commit again with the same message:

git commit -c ORIG_HEAD

(Or make a new commit message)

Now add the files for the next commit:

git add next.commit.file.txt
git commit -m "next commit message"
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167