git 如何查看本地未推送的提交?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16323409/
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
How do I see my local unpushed commits?
提问by user565660
If I have a local branch test
and the remote branch is test
.
So if I did a push it would be push origin test:test
如果我有一个本地分支test
而远程分支是test
. 所以如果我推动它会是push origin test:test
How can I see my local unpushed commits that I did on that branch?
git log
?
如何查看我在该分支上所做的本地未推送提交?
git log
?
回答by Fran?ois
I generally use gitk --all
for that (after a git fetch --all
).
我通常使用gitk --all
它(在 a 之后git fetch --all
)。
And, for console mode, I have an alias of git log --graph --all --decorate --oneline
which gives a nice and compact overview of your branches. In particular, it shows what you can push.
而且,对于控制台模式,我有一个别名,git log --graph --all --decorate --oneline
它可以很好地简洁地概述您的分支。特别是,它显示了您可以推送的内容。
For both these commands you can specify branches (test origin/test
in your case) instead of showing them all with --all
.
对于这两个命令,您可以指定分支(test origin/test
在您的情况下),而不是用--all
.
回答by Andomar
First fetch the remote's changes to your local repository:
首先获取远程对本地存储库的更改:
git fetch origin test
This will place all commits from the remote's test
branch in origin/test
. Now you can use git log
:
这会将来自远程test
分支的所有提交放在origin/test
. 现在您可以使用git log
:
git log origin/test..test
That will show all commits on test
that are not reachable from origin/test
.
这将显示test
无法从origin/test
.