What are the Git commands to do the following workflow?
Scenario
I cloned from a repository and did some commits of my own to my local reposit
You could git fetch origin
to update the remote branch in your repository to point to the latest version. For a diff against the remote:
git diff origin/master
Yes, you can use caret notation as well.
If you want to accept the remote changes:
git merge origin/master
I just use
git remote update
git status
The latter then reports how many commits behind my local is (if any).
Then
git pull origin master
to bring my local up to date :)
I simply use
git fetch origin
to fetch the remote changes, and then I view both local and pending remote commits (and their associated changes) with the nice gitk tool involving the --all
argument like:
gitk --all
A good way to have a synthetic view of what's going on "origin" is:
git remote show origin
My regular question is rather "anything new or changed in repo" so whatchanged comes handy. Found it here.
git whatchanged origin/master -n 1
One potential solution
Thanks to Alan Haggai Alavi's solution I came up with the following potential workflow:
Step 1:
git fetch origin
Step 2:
git checkout -b localTempOfOriginMaster origin/master
git difftool HEAD~3 HEAD~2
git difftool HEAD~2 HEAD~1
git difftool HEAD~1 HEAD~0
Step 3:
git checkout master
git branch -D localTempOfOriginMaster
git merge origin/master