I have a mix of deleted
, new
and modified
files in my git staging
area,
i.e. they are already all add
ed to the staging area and are ready to be finally commit
ted to the repository.
How do I commit file by 'status' instead of using a pathspec?
Example, how do I commit
(from the staging
area) only the files that have been deleted
, but leave new
and modified
files alone, in staging?
The reason is because I want to create separate atomic commits with separate comments that are more exact/applicable to the files being committed.
If possible, I would:
You can add by status (as shown here) with:
git add --all $(git diff --diff-filter=D --name-only)
D
is for deleted. Use other filters, like A
for added or M
for modified.