Viewing Unpushed Git Commits
How can I view any local commits I've made, that haven't yet been pushed to the remote repository? Occasionally, git status
will print out that my branch is X commits ahead of origin/master
, but not always.
Is this a bug with my install of Git, or am I missing something?
git log origin/master..HEAD
您也可以使用相同的语法查看diff
git diff origin/master..HEAD
If you want to see all commits on all branches that aren't pushed yet, you might be looking for something like this:
git log --branches --not --remotes
And if you only want to see the most recent commit on each branch, and the branch names, this:
git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
You can show all commits that you have locally but not upstream with
git log @{u}..
@{u}
or @{upstream}
means the upstream branch of the current branch (see git rev-parse --help
or git help revisions
for details).
上一篇: 功能提高速度:将整数转换为32位整数列表
下一篇: 查看未压入的Git提交