列出尚未推送到源的 Git 提交
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3080509/
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
List Git commits not pushed to the origin yet
提问by takeshin
Possible Duplicate:
Viewing Unpushed Git Commits
可能的重复:
查看未推送的 Git 提交
How do I list all commits which have not been pushed to the origin yet?
如何列出尚未推送到源的所有提交?
Alternatively, how to determine if a commit with particular hash have been pushed to the origin already?
或者,如何确定是否已将具有特定哈希的提交推送到源?
回答by Dan Moulding
git log origin/master..master
git log origin/master..master
or, more generally:
或者,更一般地说:
git log <since>..<until>
git log <since>..<until>
You can use this with grep to check for a specific, known commit:
您可以将其与 grep 一起使用来检查特定的已知提交:
git log <since>..<until> | grep <commit-hash>
git log <since>..<until> | grep <commit-hash>
Or you can also use git-rev-list to search for a specific commit:
或者你也可以使用 git-rev-list 来搜索特定的提交:
git rev-list origin/master | grep <commit-hash>
git rev-list origin/master | grep <commit-hash>
回答by Aristotle Pagaltzis
how to determine if a commit with particular hash have been pushed to the origin already?
如何确定具有特定哈希的提交是否已被推送到源?
# list remote branches that contain $commit
git branch -r --contains $commit