Last active
July 16, 2024 14:40
-
-
Save jtdp/5443297 to your computer and use it in GitHub Desktop.
See changes before pulling from remote git repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
and as a git alias
diffR = !CURRENT=$(git current) && git fetch origin $CURRENT && git log $CURRENT..origin/$CURRENT && git diff $CURRENT..origin/$CURRENT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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)