In order to fetch these changes from your remote, or in other words, download the changes to your local branch, you will perform a Git pull. Under the covers, a Git pull is actually a Git fetch followed by a Git merge. Git pull is just a shortcut to perform both of these actions in one step.
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
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}..'
Git can't send that kind of information over the network, like Hg can. But you can run git fetch
(which is more like hg pull
than hg fetch
) to fetch new commits from your remote servers.
So, if you have a branch called master
and a remote called origin
, after running git fetch
, you should also have a branch called origin/master
. You can then get the git log
of all commits that master
needs to be a superset of origin/master
by doing git log master..origin/master
. Invert those two to get the opposite.
A friend of mine, David Dollar, has created a couple of git shell scripts to simulate hg incoming/outgoing
. You can find them at http://github.com/ddollar/git-utils.
Not a full answer but git fetch will pull the remote repo and not do a merge. You can then do a
git diff master origin/master
Use "git log origin..HEAD"
Use "git fetch" followed by "git log HEAD..origin". You can cherry-pick individual commits using the listed commit ids.
The above assumes, of course, that "origin" is the name of your remote tracking branch (which it is if you've used clone with default options).
There's also this, for comparing all branches:
git log --branches --not --remotes=origin
This is what the git log man page says about this:
Shows all commits that are in any of local branches but not in any of remote tracking branches for origin (what you have that origin doesn’t).
The above is for outgoing
.
For incoming
, just swap:
git log --remotes=origin --not --branches
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With