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

查看:350
本文介绍了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]在答案的末尾添加了'42'..txt(本地提交)

* - 添加'Hello World'到my.txt结束(本地提交)

* - 添加'C#/。NET'到my.txt的开头(本地提交)

* - < [RemoteRepo]>(原始repo我克隆的)

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)

我如何可以查看所有我的更改的总和之间的差异<$与从 RemoteRepo中检出的原始版本相比,c $ c> my.txt answers.txt code>?

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?

推荐答案

有三种方式
$ b

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天全站免登陆