比较本地git分支与远程分支?
我如何看到本地分支和远程分支之间的diff
?
要更新远程跟踪分支,您需要先键入git fetch
,然后:
git diff <masterbranch_path> <remotebranch_path>
你可以通过git branch -a
列出所有分支(本地和远程),然后从列表中选择分支名称(只需从远程分支名称中删除remotes/
远程分支。
例如: git diff master origin/master
(其中“master”是本地主分支,“origin / master”是远程即原始分支和主分支)。
git diff <local branch> <remote>/<remote branch>
例如git diff master origin/master
,或者git diff featureA origin/next
当然, 曾经说过,你需要远程跟踪分支git fetch
第一; 并且您需要它获得有关远程存储库中分支机构的最新信息。
第一类
git branch -a
获取可用分支的列表。 在输出上你可能会看到类似的东西
* master
remotes/main/master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/mt
remotes/upstream/master
remotes/upstream/mt
然后显示差异
git diff --stat --color remotes/main/master..origin/master
git diff remotes/main/master..origin/master
链接地址: http://www.djcxy.com/p/111.html
上一篇: compare local git branch with remote branch?
下一篇: git branch, fork, fetch, merge, rebase and clone, what are the differences?