How to make git status show only staged files
Solution 1:
Use git diff --name-only
(with --cached
to get the staged files)
Solution 2:
The accepted answer won't let you know what kind of changes were there.
Yes, If you are not syntax checker but an ordinary person with a repository full of unstaged files, and you still want to know what will happen to staged files - there is another command:
git status --short | grep '^[MARCD]'
which leads to something like:
M dir/modified_file
A dir/new_file
R dir/renamed -> dir/renamed_to
C dir/copied_file
D dir/deleted_file
Obviously, this files were staged, and after git commit
:deleted_file
will be deleted,new_file
will be added,renamed_file
will become a renamed_to
.
Here is an explanation of short-format output: https://git-scm.com/docs/git-status#_short_format