Git - 如何比對本機與遠端分支 diff local and remote branch

紀錄一下比對 local branch 及 remote branch 的語法

# 指令
git diff <local-branch> <remote>/<remote-branch>

# 如果要看這次的修改 <commit> 會對遠端分支造成什麼變動,可以改變 branch 的位置
git diff <remote>/<remote-branch> <local-branch>

# 更簡潔的版本
git diff origin
git diff @{upstream}
git diff @{push}

參考資料

https://stackoverflow.com/questions/1800783/how-to-compare-a-local-git-branch-with-its-remote-branch

@{upstream} & @{push} 解釋 https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions

comments powered by Disqus