Is there a way to see what commits have been pulled in from the remote repository after you do a git pull --rebase?
In other words: git pull will show a summary of changed files at the end (like git diff --stat). Git pull --rebase does not. How can I see this information anyway, if at all possible?
I know this is possible after a normal git pull or by doing a manual git fetch first, by comparing local & remote branches using git log master..origin/master --stat or similar, but this does not work after a git pull --rebase, unless I'm doing something wrong...
To clarify, my question is 2-part:
1) How to view diffstat (summary of changed files) after a git pull --rebase, similar to what git pull shows.
2) How to view log of all new "incoming" commits after a git pull --rebase.
Actually,
git rebasehas had this all along (well, since 1.6.something). Remember thatgit pullis justgit fetchfollowed by eithergit mergeorgit rebase(as directed by various options and settings). That is,git pulldoes a pair of underlying git operations.The reason it does not work after you have finished your
git pullis thatgit pullis in fact that pair of operations, and if you just did one pair, there are probably no new changes brought in by your secondgit fetch, so there is nothing new to show. If you were to use your reflog history to reset items to the state they were in before the first pair of operations, the second pair of operations would have something to show.You can (as I see VonC has already noted) get an after-the-fact report on what changed in either the upstream or your local branch using your own reflogs. But presumably you want to see this on the next
git pulleven if that does arebase, and that's where a sneaky set of git defaults come in.If you manually add
--statto yourgit pullline, thepullscript passes this option on to eithergit mergeorgit rebase(whichever one it runs). If you leave this option out, git relies on a default option.The default
--statoption forgit mergeis the setting in your configuration'smerge.stat, which defaults to True. The default--statoption forgit rebaseis the setting in your configuration'srebase.stat, which defaults to False.Let me repeat that, because it's just peculiar and non-obvious (I only discovered this because of your question—I generally avoid
git pullmyself).The default
--statoption formergeisTruebut the default--statoption forrebaseisFalse.If you set the defaults yourself, you can make the stat output show up.
Alternatively, you can pass an explicit
--stattogit pull.Note that you can also set
pull.rebase(to eitherTrue, meaning default to rebasing, orpreserve, meaning default to rebase with--preserveas well), orbranch.name.rebase(toTrueorpreserve), to makegit pulluse--rebase. This is independent of whether you supply--statas apullargument.Edit: VonC's answer is gone (at least right now) but there are bits of it in various comments. The trick to use after the fact is that when
git fetchupdatesorigin/develop, your own reflog now contains anorigin/develop@{1}: your own previous value fororigin/develop, beforegit fetchupdated it. Thus, you can select the revision-set that came in withorigin/develop@{1}..origin/develop. Diffing those two with--statwill get you the desired output. Note that you may, or may not depending on your particular shell, have to quote the curly braces in the@{1}part.