List Git commits not pushed to the origin yet

Git

Git Problem Overview


> Possible Duplicate:
> Viewing Unpushed Git Commits

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?

Git Solutions


Solution 1 - Git

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:

git log <since>..<until> | grep <commit-hash>

Or you can also use git-rev-list to search for a specific commit:

git rev-list origin/master | grep <commit-hash>

Solution 2 - Git

> 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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontakeshinView Question on Stackoverflow
Solution 1 - GitDan MouldingView Answer on Stackoverflow
Solution 2 - GitAristotle PagaltzisView Answer on Stackoverflow