I'm after git command that shows all files currently residing inside staging area (is it the same as index?).
First I removed all files from index:
$ git rm --cached *
rm 'newfile'
rm 'os-list.txt'
rm 'remote_stuff'
rm 'removethis'
Now I check files in index:
$ git ls-files --stage
100644 07e6e472cc75fafa944e2a6d4b0f101bc476c060 0 .gitignore
You can see only .gitignore file is left.
We then change the content of newfile. Then we add newfile to index.
$ git add newfile
Check the status:
$ git status -s
M newfile
D os-list.txt
D remote_stuff
D removethis
?? os-list.txt
?? remote_stuff
?? removethis
We can see newfile is now in index.
Now we expect staging area to be empty when we commit the files.
$ git commit -m "TEST333"
[master 0adab53] TEST333
4 files changed, 1 insertion(+), 13 deletions(-)
delete mode 100644 os-list.txt
delete mode 100644 remote_stuff
delete mode 100644 removethis
But even after commit we see newfile is still in staging area:
$ git ls-files --stage
100644 07e6e472cc75fafa944e2a6d4b0f101bc476c060 0 .gitignore
100644 76abab2928bdd7dfe157109666023bb0c5e4c465 0 newfile
But if we check status we see there's nothing in staging area:
$ git status -s
?? os-list.txt
?? remote_stuff
?? removethis
Well, what I'm after is the command to show all files in staging area. The command git ls-files --stage
is returning output that I don't understand.
Thanks!