Git list of staged files
Solution 1:
The best way to do this is by running the command:
git diff --name-only --cached
When you check the manual you will likely find the following:
--name-only
Show only names of changed files.
And on the example part of the manual:
git diff --cached
Changes between the index and your current HEAD.
Combined together, you get the changes between the index and your current HEAD and Show only names of changed files.
--staged
is also available as an alias for --cached
above in more recent Git versions.
Solution 2:
You can try using git ls-files -s