Here are two different questions but I think they are related.
When using Git, how do I find which changes I have committed locally, but haven't yet pushed to a remote branch? I'm looking for something similar to the Mercurial command hg outgoing
.
When using Git, how do I find what changes a remote branch has prior to doing a pull? I'm looking for something similar to the Mercurial command hg incoming
.
For the second: is there a way to see what is available and then cherry-pick the changes I want to pull?
Starting with Git 1.7.0, there is a special syntax that allows you to generically refer to the upstream branch: @{u}
or @{upstream}
.
To mimic hg incoming
:
git log ..@{u}
To mimic hg outgoing
:
git log @{u}..
I use the following incoming
and outgoing
aliases to make the above easier to use:
git config --global alias.incoming '!git remote update -p; git log ..@{u}'
git config --global alias.outgoing 'log @{u}..'