git 如何在git中列出本地提交差异

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7602875/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 06:02:16  来源:igfitidea点击:

How to list local commits difference in git

gitversion-control

提问by mr.b

I have a remote repository cloned locally, and over time, I have added local commits to that cloned repository.

我有一个在本地克隆的远程存储库,随着时间的推移,我向该克隆的存储库添加了本地提交。

Now, whenever I do git status, I see Your branch is ahead of 'origin/master' by xx commitsmessage.

现在,每当我这样做时git status,我都会看到您的分支通过 xx 提交消息领先于 'origin/master'

Q:How do I list only commits made locally, so that I can examine these commits into more detail, and eventually merge some of them into upstream?

问:如何只列出本地提交的提交,以便我可以更详细地检查这些提交,并最终将其中一些合并到上游?

回答by dmedvinsky

You can do it by specifying the range to the logcommand:

您可以通过为log命令指定范围来实现:

git log origin/master..master

Use your branch name instead of master, of course.

当然,使用您的分支名称而不是 master。

You can read more for example here: What are the differences between double-dot ".." and triple-dot "..." in Git commit ranges?

您可以在此处阅读更多示例:Git 提交范围中的双点“..”和三点“...”之间有什么区别?

Also, read man gitrevisions.

另外,阅读man gitrevisions