Now that I don’t use Mercurial at work anymore, I’ve found that despite its shortcomings (
hg status taking 10+ seconds?!) it has some few nice features. One of those is
hg outgoing, which shows you which changesets you are going to send to remote repo in your next push. A quick glance at this list will typically ensure that everything is in order, or allow to amend some commits before making them public.
In Git you can do the similar by applying a filter to
origin is most often the remote you want to compare against, the
master branch is typically not the one where most of development takes place. So if we want to create a
git outgoing command, we would rather check what the current branch is and compare it with its remotely tracked equivalent:
Simply naming this script
git-outgoing and making it executable somewhere within your
/usr/bin) will make the
git outgoing command available:
There are few untold assumptions here, like the fact that branch names must match on both local and remote repo. If you find yourself breaking those, then you’re probably better to just use
git log directly.