Reputation: 9096
I'm looking to see the best way to see changes on a given remote branch after a git fetch
, but I want to ignore the changes I've committed (but not pushed/merged). Generally, my flow is
git commit
git commit # something else
git fetch
git diff HEAD^^..origin/stable # HEAD^^ is the commit right before my two commits above
Wanted to see if there was a way to handle that HEAD^^ to show me what has changed between what I knew of origin/stable (in this case, HEAD^^) and what origin/stable is after the fetch.
Basically, I want to see all new code committed to the branch since my last fetch, ignoring any staged (or unstaged) changes I have on my local branch.
Thanks for the help.
Based on @carl-norum's answer below, I added the following to .git/config
[alias]
fetch-diff = !git fetch 2>&1 | awk '/[a-z0-9]+[.][.][a-z0-9]+/ { print $1 }' | xargs -L 1 git diff
and now use git fetch-diff
which will fetch and print the diffs for each branch.
Upvotes: 1
Views: 1932
Reputation: 224924
git diff HEAD^^ origin/stable
Should do exactly what you're looking for. However, the fetch
operation should provide you some output like:
76e5999..0564fab master -> origin/master
Showing what hashes changed on origin/master
(in my example). You could just do:
git diff 76e5999 0564fab
And see all of those diffs.
Upvotes: 2