arpit joshi
arpit joshi

Reputation: 2134

Get first commit of a branch created from master

I have a branch lets say dev. I created my feature branch from dev. dev has commits starting from 2014.

So

  dev 
    |
    ---FeatureBranch created on June 10 2021

I made my 10 commits on my feature branch lets say on June 10, June 11, June 12.

How can I get first commit on my feature branch?

I tried git log --reverse but would give me first commit as 2014 because my feature branch will consist all commits from dev branch too.

How can I get the first commit id on my feature branch after it was created from dev?

Upvotes: 0

Views: 1819

Answers (1)

matt
matt

Reputation: 534977

You might be looking for

git log --oneline dev..feature --reverse

That's the commits on feature but not on dev, in reverse order, so the first one is the one you're looking for. There are much cooler ways to do this, but that's the simple and obvious way.

Upvotes: 1

Related Questions