If I do "git branch -a" in my terminal, does a branch of a branch (so a branch I made off of another branch) look different from a branch off of origin? For example, if I have a branchB off of branchA, should the branch look like: origin/branchA/branchB?
Asked
Active
Viewed 38 times
2
-
git branch will just print out your local branches. git branch -a will print out local branches and remote branches. Not sure what you're trying to accomplish here. – doct03 Apr 19 '20 at 15:58
-
that's what I wanted to do: look at all my branches. My question had nothing to do with the command or what it does. – dimestorecoffee Apr 20 '20 at 18:02
-
Sorry about that. I misread your question. – doct03 Apr 21 '20 at 03:19
2 Answers
2
No.
Unless you name it that, anyway. All that is displayed is the branch's name, which can be anything you want.

hobbs
- 223,387
- 19
- 210
- 288
2
The reasons branchB
does not appear as branchA/branchB
are:
that would imply some kind of strong coupling between
branchA
andbranchB
, which makes no sense considering:branchA
can be deleted at any time (that won't delete the commits it referenced):branchB
would still be there, unchangedbranchB
can be rebased at any time on top of any other branchbranchB
has no knowledge of any other branch it is "based" upon: it only references a commit (and all commits reachable from its HEAD)
a slash is allowed in a branch name: you can name it
xxx/yyy
(as one branch): this is for defining a hierarchy in a branch naming convention.
Typical examples:- Gerrit branches for review:
refs/for/REL1_20/bug/36151
: thefor/REL1_20/bug/36151
is one (Gerrit) branch. - GitHub Pull Request branches:
git fetch origin pull/ID/head:BRANCHNAME
:pull/ID
is one (PR) branch
- Gerrit branches for review:

VonC
- 1,262,500
- 529
- 4,410
- 5,250