as opposed to the long relative path?
In addition to the accepted answer, another way of doing it is with awk
git status --porcelain | awk '{ print $2 }'
The $2
selects second the column of each line.
git status
will always walk down (edit and up) the tree and display relative paths. If you only want the file in the directory you are in, See this related answer
Aha, I think I just understood the question: you want basenames? Tack on | while read a; do basename "$a"; done
to any of the following:
how about
git diff --name-only
for changes relative to index
git diff --name-only --staged
for ... well staged chages :)
git diff --name-only HEAD
got both