I am trying to avoid the need to parse the output of "git status". Is there a command that will return a list of all the committed files that will get pushed on the next "git push" command?
I am trying to avoid the need to parse the output of "git status". Is there a command that will return a list of all the committed files that will get pushed on the next "git push" command?
You should try
git diff --stat --cached origin/<<branch name>>
Example :
git diff --stat --cached origin/master
The --stat generates a diffstat.
The --cached is to view the changes you staged.
Let me know if this works.
Short answer
git log --pretty=format:"" --name-only @{upstream}.. | sort -u
Explanation
--pretty=format:"" to suppress commit info
--name-only asks for the list of files
@{upstream} is a construct to describe the remote branch the current one is linked to. It's not a placeholder, it's meant to be written as is.
@{upstream}.. (mind the .. which makes it a range) means everything on current branch but is unknown to the remote branch.
Of course, it's more useful to have it sorted in case you have many commits modifying the same files. Use | sort -u for this purpose.
Final note : Make it an alias!
# pf = Push Files (could be whatever else you prefer)
git config --global alias.pf '!git log --pretty=format:"" --name-only @{upstream}.. | sort -u'
# then just
git pf