I have a branch in a GitHub repository, how can I find the branch it branched from? When I look at the commit history within the branch, it shows me all the commits for the branch but nothing seems to mark to the first commit where it branched (i.e. the first commit of the branch).
Asked
Active
Viewed 1,917 times
2 Answers
1
i suggest to use the CLI on your local repo:
git config --global color.ui auto
git log --graph --oneline --all
Scroll until you see the branches that you search for.
There are also some other alternative as well of course like:
git merge-base

CodeWizard
- 128,036
- 21
- 144
- 167
-
Thanks, aside from manually browsing this graph (which is huge and long), is there any other way of getting this information using the CLI? – Josh Jul 16 '14 at 00:37
-
there are several ways to travest the log tree. this is the most simple one. Im a big fan of CLI but for diff and view log history im recommanding using sourcetree http://www.sourcetreeapp.com/ – CodeWizard Jul 16 '14 at 00:37
-
1Thanks. Would it be correct to assume that doing an exhaustive `git merge-base` against all branches (current and closed) could do it? If so, how can I go to doing this using the CLI? – Josh Jul 16 '14 at 00:42
-
if you use windows right click on the repository folder and choose "Git Bash here". If you use unix/mac etc open terminal and navigate to the working repository dir – CodeWizard Jul 16 '14 at 00:45
1
git doesn't have a notion of "branching points". A git commit can be through of as a node in a singly linked list, each commit knows about it's parent(s) only.
With that said, to get an overview of the history of a git repository you can use
git log --oneline --graph --all --decorate
and all it's variants.

Patrik Oldsberg
- 1,540
- 12
- 14