Reputation: 36654
I have a bulk of modified files.
I want to commit them in 3 commits.
(some added by auto-merge, some relevant for bug1, some relevant for bug2)
how can I commit only 2 files out of 30 ?
how can I commit 25 out of 30 ?
Upvotes: 1
Views: 73
Reputation: 4971
Firstly, add all files:
git add .
To commit 2(or any less no.) files:
git commit -m "my commit msg" file1 file2
To commit 25:
git commit -m "my commit msg" file1 file2 .. file25
or
git reset HEAD file26 file27 ..
git commit -m "my commit msg"
Basically, first remove the files you don't want to commit from "Changes to be committed" list, then commit all remaining ones.
Upvotes: 1
Reputation: 5758
You can add only 2 files and commit!
$git add <file1>
$git add <file12>
$git commit -m "Your message"
If you permanently dont want to stage file(s), make a .gitignore
file in you folder where you have initialised the git and specify the files that dont want to be tracked.
Upvotes: 0