如何将本地git分支与其远程分支进行比较? [英] How to compare a local git branch with its remote branch?

查看:121
本文介绍了如何将本地git分支与其远程分支进行比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何查看本地分支和远程分支之间的diff?

How can I see the diff between a local branch and a remote branch?

推荐答案

要更新远程跟踪分支,您需要先输入git fetch,然后输入:

To update remote-tracking branches, you need to type git fetch first and then :

git diff <masterbranch_path> <remotebranch_path>

您可以git branch -a列出所有分支(本地和远程),然后从列表中选择分支名称(只需从远程分支名称中删除remotes/.

You can git branch -a to list all branches (local and remote) then choose branch name from list (just remove remotes/ from remote branch name.

示例:git diff master origin/master(其中"master"是本地master分支,"origin/master"是远程即Origin和master分支.)

Example: git diff master origin/master (where "master" is local master branch and "origin/master" is a remote namely origin and master branch.)

这篇关于如何将本地git分支与其远程分支进行比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆