Git:将所有本地提交与远程仓库版本进行比较 [英] Git: Compare All Local Commits to Remote Repo Version

查看:24
本文介绍了Git:将所有本地提交与远程仓库版本进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Git 有点陌生,我正在尝试做的事情似乎应该是可能的.基本上我一直在克隆一个 repo 并且做了很多本地提交.有没有办法查看我所有更改的总和"与原始回购版本的差异?我认为这是可能的,因为当我执行 push 时,Git 基本上会这样做.

I'm somewhat new to Git and what I'm trying to do seems like it should be possible. Basically I've been working off of clone of a repo and have made quite a few local commits. Is there a way to see the diff of the 'sum' of all my changes and the original repo version? I would assume this would be possible because Git will essentially do this when I do a push.

这是我正在尝试做的一个例子:在 gitk 我会看到这样的东西:
* - [mybranch] 在 answers.txt 末尾添加了42"(本地提交)
* - 在 my.txt 末尾添加了Hello World"(本地提交)
* - 在 my.txt 的开头添加了C#/.NET"(本地提交)
* - <[RemoteRepo]>(我克隆的原始仓库)

Here is an example of what I'm trying to do: in gitk I will see something like this:
* - [mybranch] Added '42' to end of answers.txt (local commit)
* - Added 'Hello World' to end of my.txt (local commit)
* - Added 'C#/.NET' to beginning of my.txt (local commit)
* - <[RemoteRepo]> (original repo I cloned from)

与我签出的原始版本相比,我如何查看对 my.txtanswers.txt 的所有更改的总和的差异RemoteRepo?

How is it I can view the difference of the sum of all my changes to my.txt and answers.txt when compared to the original version I checked out from RemoteRepo?

推荐答案

有三种方式(这里给出的其他答案中的另外两种)

There are three ways ( two others from other answers given here )

1) git diff origin/master master
2) git diff origin/master..master
3) git diff origin/master...master

第一个和第二个是相同的,并且显示主控和远程主控的提示之间的变化.

First one and second one are same and show changes between the tips of the master and remote master.

第三个显示自分支上次推送以来在主服务器上发生的更改,我认为这是您正在寻找的最合适的更改

Third one shows changes that occurred on the master since branch last push and I think this is the most appropriate one you are looking for

这篇关于Git:将所有本地提交与远程仓库版本进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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