How To List Files That Will Be Pushed In Git
2 min readSep 18, 2021
The aim of this pageđź“ťis to find files that are
a) committed
b) not pushed yet
c) will be pushed with git push
command
It is simplified for checking just branches that are set as matching already (e.g. master
<> origin/master
)
1. notes
- The command itself
git diff --stat --cached [remote/branch]
- For the master branch, it would be
git diff --stat --staged origin/master
--stat
generates only diffstat--staged
is synonym with--cached
… view the changes you staged for the next commit relative to the named <commit> … if you do not give <commit>, it defaults to HEAD (pavol: HEAD of the provided <path>, i.e. HEAD of your<remote branch>)…
…--staged
is a synonym of--cached
<path>
is the upstream tracking branch you are running diff against- you can keep committing and the difference between local/remote just gets aggregated in the “report” above —
git log
would keep commits separated. You can be 5 commits ahead and you get a single table listing all the files that will fly to the repo with the nextgit push
2. example
â–¶ git diff --stat --staged origin/master
powershell/rdbldev.ps1 | 2 +-
productivity/2021-09-14-What-is-Proper-Risk.md | 21 +++++++--
...rShell-Terminal-Exemplified-on-JSON-minifier.md | 11 ++++-
...rt-Into-a-List-at-a-Given-Position-in-Python.md | 54
.../2021-09-17-How-To-Delete-a-File-in-Python.md | 32 +
...021-09-17-Test-Path-and-Act-Idiom-in-Python.md} | 10 ++--
python/pyth_boards.md | 6 +--
sicp/10_01-Computational-Objects.md | 39
sicp/10_02-Agendas-and-Queues.md | 27 +++++++++++
sicp/sicp-home.md | 5 +-
10 files changed, 183 insertions(+), 24 deletions(-)