$ git remote update
or
$ git fetch -p # fetch and purge old data
用來更新本地 git repo 追蹤的 remote repo 當下的狀態
在 merge 之前 可以先查看本地 repo 與追蹤的 repo 間的變化
在想追蹤的 git repo 沒有被加入 remote 的情況下 我們可以先加入 remote 在 fetch
$ git remote add hello_remote <path/to/git/repo>
$ git fetch hello_remote
或是在指令列直接指出要追蹤的 repo 如下
$ git fetch git://repo/stranger.git
or
$ git fetch git://repo/stranger.git master
輸入
$ git log -p ..FETCH_HEAD
可以知道 remote master branch 與當前 branch 之間的差異
透過 gitk 我們可以觀看歷史的線圖
$ gitk --all FETCH_HEAD
由於我們是 直接 fetch 沒有被加入 remote 的 git repo 此時需要加上 FETCH_HEAD 這個參數 才能看到在圖裡面看到 FETCH_HEAD
如果你偏好 CLI
$ git log --graph --pretty=format:'%C(yellow)%h%Creset -%Cred%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=r --all FETCH_HEAD
Ref
What does FETCH_HEAD in Git mean?
12:37 am - Fun with FETCH_HEAD http://gitster.livejournal.com/28309.html