简体   繁体   中英

How to see whats new in the git main repo without doing a pull

每天我上班,然后执行“ git pull”以将所有更新的代码保存到我的develop分支中。

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.

git fetch origin您可以使用命令git log --left-right --graph --cherry-pick --oneline HEAD...origin/master ,它将显示您和orign/master之间的提交差异。

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".

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM