Last Updated: September 02, 2019
·
13.52K
· crev

git outgoing/incoming changes

Mercurial has two nice commands: incoming and outgoing changes.
Those commands allow to see the commits which are pushed but not fetched and the commits which are not pushed.

By default, thoses commands does not exists in git. But it's really simple to use git's aliases to do it :

Outgoing

git log --pretty=oneline --abbrev-commit --graph @{u}..

Incoming

git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u}

Add this to your alias section in ~/.gitconfig if you want :

out = log --pretty=oneline --abbrev-commit --graph @{u}..
in = !git fetch && git log --pretty=oneline --abbrev-commit --graph ..@{u}

4 Responses
Add your response

These are a bit mixed up... your "Incoming" command should have the "git fetch" instead of "Outgoing".. but in the last section for .gitconfig, you have the fetch on the right one but the log commands are backwards (out should be @{u}.. and in should be ..@{u})

over 1 year ago ·

Thanks for pointing out the errors. I've edited the protip to fix it.

over 1 year ago ·

Little add for outgoing stat

git log --pretty=oneline --abbrev-commit --graph @{u}.. --stat
over 1 year ago ·

I don't really use --stat but for the outgoing it's pretty nice and help to see what changed. Thanks.

over 1 year ago ·