Skip to content

Instantly share code, notes, and snippets.

@jtdp
Last active March 13, 2024 12:58
Show Gist options
  • Star 74 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save jtdp/5443297 to your computer and use it in GitHub Desktop.
Save jtdp/5443297 to your computer and use it in GitHub Desktop.
See changes before pulling from remote git repository
# fetch the changes from the remote
git fetch origin
# show commit logs of changes
git log master..origin/master
# show diffs of changes
git diff master..origin/master
# apply the changes by merge..
git merge origin/master
# .. or just pull the changes
git pull
@reharik
Copy link

reharik commented May 23, 2022

Here's a version for current branch
git fetch origin $(current_branch); git log $(current_branch)..origin/$(current_branch); git diff $(current_branch)..origin/$(current_branch)

@reharik
Copy link

reharik commented May 23, 2022

and as a git alias
diffR = !CURRENT=$(git current) && git fetch origin $CURRENT && git log $CURRENT..origin/$CURRENT && git diff $CURRENT..origin/$CURRENT

@firstChairCoder
Copy link

Thanks for sharing @reharik @jtdp !! 👐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment