How to only view commits created on a fork or branch?

So, if I have a project that was forked, and I want to view only commits added to the fork, and not commits from the original project; how can I do that?

Or more generally, view only commits added on the current branch? e.g. branch ‘feature’ was created from master, and I’d like to see a list of all commits created on feature, but not the commits from master?

Hi @icodesometime,

This post was moved to a different board that fits your topic of discussion a bit better. This means you’ll get better engagement on your post, and it keeps our Community organized so users can more easily find information.

As you’ll notice, your Topic is now in the How to use Git and GitHub board. No action is needed on your part; you can continue the conversation as normal here.

Let me know if you have any other questions or if I can help with anything else.

Cheers!

Thanks… Sorry, this is my first time using the forum

1 Like

You can see the commits that exist only on the target branch but not on the base branch with the following (rather long) command:

git log --decorate --pretty=oneline --abbrev-commit --no-merges --first-parent base..target

If you want to see what the various options do, you can view this command on explainshell.com.

I hope that helps!

2 Likes

Cool, thanks! I gather there’s no way to do this in GitHub then?

Hi @icodesometime,

Actually you should be able to view all the commits for a branch on github.com. To do so, you just need to select the branch from the “Branch” dropdown.

This will put you directly on the branch whose commits you want to view. Then you can select “Compare”

This will allow you to view a list of all the commits made for that branch.

Hope this helps! Cheers!

4 Likes

What if I want to view last commits to master?

Compare does not show on master…

On github you can go to repository you need, and then append to the address string the
.../commits/branch-name line

So you will get something like this:

https://github.com/some-account/some-repository/commits/branch-name