Reputation: 713
everyday I come into work and I do a "git pull" to get all the updated code in my develop branch.. can someone please tell me a why before I do my pull to see what changed
Upvotes: 0
Views: 93
Reputation: 55573
Consider reading this explanation of git pull
, git fetch
, git merge
and their relations.
To cite this document:
Why not git pull?
Well, git pull is fine most of the time, and particularly if you’re using git in a CVS-like fashion then it’s probably what you want. However, if you want to use git in a more idiomatic way (creating lots of topic branches, rewriting local history whenever you feel like it, and so on) then it helps a lot to get used to doing git fetch and git merge separately.
Upvotes: 0
Reputation: 41
After a git fetch origin
you can use the command git log --left-right --graph --cherry-pick --oneline HEAD...origin/master
which will show the difference of commit between you and orign/master
.
Upvotes: 1
Reputation: 1672
You could do a git fetch
and then git log origin/X
to view changes or git diff X origin/X
to see the difference between your branches. Once you are happy to merge your changes in, you can do a git merge origin/X
while in X.
Upvotes: 2
Reputation: 5224
You can fetch the code and review the log in staging:
➜ cortex git:(master) ✗ git fetch origin
remote: Counting objects: 1229, done.
...
Resolving deltas: 100% (720/720), completed with 117 local objects.
From github.com:icortex/test
087dfaf..7212fc2 master -> origin/master
* [new branch] test-jobs -> origin/test-jobs
➜ cortex git:(master) ✗ git log origin/test-jobs
As you can see the branch master
has changes and test-jobs
is a new branch. Then you can check the log on each branch in "origin".
Upvotes: 0