本文翻译自:List Git commits not pushed to the origin yet [duplicate]
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? 或者,如何确定具有特定哈希值的提交是否已被推送到原点?
#1楼
参考:https://stackoom.com/question/cVnD/列表Git提交尚未推送到原始位置-重复
#2楼
git log origin/master..master
or, more generally: 或者,更一般而言:
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>
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>
#3楼
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