Git: Creating branch out another branch showing on main level

498 Views Asked by At

I have created a new branch out another branch:

master ---develpment ---------FeatureA

But if I check the branch structure it shows FeatureA branch at the same level as develpment:

 git branch -a
  development
* FeatureA
  master
  remotes/origin/development
  remotes/origin/FeatureA
  remotes/origin/master

My question to guys is guy FeatureA is not showing as sub-branch of development?

I'll really appreciate your help.

2

There are 2 best solutions below

0
On BEST ANSWER

There is no such thing as a "subbranch". All branches are equal. But you can use different tools to view relations between branches. Try

git show-branch
git log --all --decorate --graph
gitk --all
0
On

In git, branches are just pointers to commits. After a branch is created, it does not remember from which branch it was created (in fact, a new branch is not necessarily created from any other branch, it can be created from any arbitrary commit) and has no relation to other branches.

See corresponding chapter in a git book.

There are various GUIs that can help you visualize the repository tree and relation between commits and branches.