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
The output of git status --porcelain, designed to be easy to parse in a script, outputs the full paths rather than relative paths regardless of where your current directory is within the tree.
Each line output by git status --porcelain has two leading characters indicating the status of the file (e.g. whether it's untracked, modified, new, deleted, etc.) followed by a space, so if you just want the full paths of everything that would be mentioned in the output of git status you can do:
git status outputs relative paths so if you cd to the same directory as the file (under your working directory's root) before running git status it will only output the basenames of added/staged files.
cd /long/path/to/my/repo/root/dir
"stuff" > ./newfile.txt
> git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: /long/path/to/my/repo/root/dir/plus/some/more/levels/of/directory/structure/inside/it/changed_file.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
# long/path/to/my/repo/root/dir/plus/some/even/more/levels/of/directory/structure/inside/it/but_another_new_file.txt
# newfile.txt
no changes added to commit (use "git add" and/or "git commit -a")
ie, 'newfile.txt' is listed without the full path because you're in the same path as it.
A much simpler solution that is built-in to git using ls-files.
From the docs:
OPTIONS
-c
--cached Show cached files in the output (default)
-d
--deleted Show deleted files in the output
-m
--modified Show modified files in the output
-o
--others Show other (i.e. untracked) files in the output
-i
--ignored Show only ignored files in the output. When showing files in the index, print only those matched by an exclude pattern. When
showing "other" files, show only those matched by an exclude pattern.
Standard ignore rules are not automatically activated, therefore at
least one of the --exclude* options is required.
-s
--stage Show staged contents' mode bits, object name and stage number in the output.
-u
--unmerged Show unmerged files in the output (forces --stage)
If you're looking for only the filenames without the path mumbo-jumbo the following should work:
git status --porcelain | cut -c 3- | xargs basename -a
This script gets the shortened format of git status, cuts each line's 3rd column to the end and feeds it to the basename command which outputs only the filename from the full path.