3

I am new to Git. I am now working on a branch named fixes. Actually I have forgotten from where I have cut the branch. So is there any way in Git so that I can know my source branch name.

Joy
  • 4,197
  • 14
  • 61
  • 131
  • 1
    Should be `master`. Run `git branch` to see list of all branches. – Šime Vidas Sep 09 '13 at 01:04
  • You can use pretty graphing or a tool like SourceTree (disclaimer: I'm somewhat affiliated with the latter). – alex Sep 09 '13 at 01:06
  • Read this: http://stackoverflow.com/questions/18667163/how-to-view-a-git-branch-only-back-to-the-point-where-it-was-branched-off/18667256#18667256 – D4NI3LS Sep 09 '13 at 01:06
  • 1
    See alsp [Find the parent branch of a branch](http://stackoverflow.com/questions/3161204/find-the-parent-branch-of-a-branch), and [Branch length: where does a branch start in Git?](http://stackoverflow.com/questions/17581026/branch-length-where-does-a-branch-start-in-git), and [Find which branch is used to create current branch in Git?](http://stackoverflow.com/questions/17665780/find-which-branch-is-used-to-create-current-branch-in-git). –  Sep 09 '13 at 01:10

3 Answers3

8

You can run 'gitk --all' and visually track your branch down to where it was branched off.

Graham Perks
  • 23,007
  • 8
  • 61
  • 83
1

If you are using github there's a network view for a repository that will show the history of all the branches. That will show you from which branch the current branch originally stemmed.

Tamar
  • 2,016
  • 1
  • 15
  • 26
0

Branches in Git do not track (by themselves) from which commit they were created, because if you follow their parent references all the way, you'll eventually just reach the root commit.

You could infer from which branch or commit a branch was created by using various tools in Git, such as merge-base.