moey
moey

Reputation: 10897

Which Branch Am I From?

Suppose we are at a master branch with 2 commits: c111 and c222; c222 is the latest commit. Now, we create a new second branch by git checkout -b second; then keep working on second.

How do we find out that second was actually branched from master at c222? I understand that second will inherit both commits (c111 and c222 from master).

Upvotes: 0

Views: 351

Answers (3)

Munim
Munim

Reputation: 6520

I am sure there is a good way to do this from the git command line tool, but I like using tig

Edit: It is easier to remember than git log --all --graph --oneline --decorate and also prettier! But yeah, you do have to install one additional tool.

Upvotes: 0

Tala
Tala

Reputation: 8928

You need to use git merge-base A B git merge-base

Also this answer might help a lot.

Upvotes: 0

nicky_zs
nicky_zs

Reputation: 3773

Trygit log --all --graph --oneline --decorate, which prints out the git log as graph, containing the branch inheriting information.

Upvotes: 2

Related Questions