查看未推送到远程的本地提交的 git 更改/差异

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12593113/
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 07:32:17  来源:igfitidea点击:

View git changes/diffs of local commits not pushed to remote

gitgit-commitgit-log

提问by Justin

I have three Gitcommits that I committed locally, but have not pushed to GitHub. I would like to view the changes/diffs for all three commits, how do I view all the diffs?

我在Git本地提交了三个提交,但尚未推送到 GitHub。我想查看所有三个提交的更改/差异,如何查看所有差异?

I tried: git log --branches --not --remotes

我试过: git log --branches --not --remotes

Which shows me the three commits, but not all the diffs/changes of each.

这向我展示了三个提交,但不是每个提交的所有差异/更改。

commit c08fbb72ae6a06e8b2ff3dbbb96fb555a43f4136
Author: Justin <[email protected]>
Date:   Mon Sep 10 18:17:02 2012 -0700

    Updated order of requires in Requires.php

commit 041fe19a48269a8aea2ccf90f53568893d4e0158
Author: Justin <[email protected]>
Date:   Mon Sep 10 17:56:42 2012 -0700

    Checking for app.config.php in Requires.php

commit 61c103a8a122bcde2311d081a8340ee1dd71997c
Author: Justin <[email protected]>
Date:   Mon Sep 10 17:42:20 2012 -0700

    Version bump 0.4.0. See CHANGELOG.md

Thanks for the help.

谢谢您的帮助。

回答by Simon Boudrias

You could probably use git diff like this:

您可能可以像这样使用 git diff:

git diff origin/master..HEAD

assuming that your HEAD is currently pointing to your latest commit. Otherwise, you could just use

假设您的 HEAD 当前指向您的最新提交。否则,你可以使用

git diff origin/master..master

(Of course, change accordingly if your remote isn't origin, or if your branch isn't master.)

(当然,如果您的遥控器不是原点,或者您的分支不是主分支,则相应地更改。)

回答by Justin

git log -p --branches --not --remotes

git log -p --branches --not --remotes

Worked.

工作。