I made some changes on my master branch. Now I want to persist my changes in several commits.
Let's say this is the result of git status:
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: ../../../.gitignore
modified: ../java/file1.java
modified: ../java/file2.java
modified: package-lock.json
modified: package.json
modified: src/index.js
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/components/authentication/
src/components/route/
src/helpers/
How can I commit file1 and file2 in one commit, and package.json and package-lock.json in the next commit? I thought of creating a new branch and moving my changes to that branch and then commit them, but I don't know how to move only a subset of these files.
git committo make the snapshot.