Viewing Unpushed Git Commits

You can view changes you have made in your local repository which haven’t been pushed to the origin (remote) repository using the following command:

git log origin/<yourbranchname>

In case your local branch has been configured with an upstream branch, then you can use the below shorthand:

git log @{u}..

or

git log @{upstream}..

If you want to see only the list of unpushed files between your local git repository and the remote repository, you can use the following useful snippet:


git log origin/<yourbranchname>.. --name-only --pretty="format:" | sort | uniq

Please leave us a thank you note in the comment below if you found this tip useful. Thanks!

  • Comment Policy: Comments adding value to the article are encouraged. Relevant links will be allowed in such comments. Comments left solely for spamming links will be deleted. Thank you for understanding.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

CommentLuv badge