Given a project with several local branches, each tracking some remote branch, is there a command that lists all branches that have unpushed commits? (That is, even if none of t
git for-each-ref --format="%(refname:short) %(push:track)" refs/heads
That remain the most precise answer that you can easily parse/grep to get the desired output (like removing up-to-date branches)
You can do so in a bash script that you will call git-xxx
(no extension), somewhere in your $PATH
or %PATH%
.
That script can then be called with git xxx
, and will use git bash.
That is portable and will work across platforms (meaning even on Windows, where
includes 200+ linux commands (grep
, sed
, awk
, xargs
, ...)