In the process of learning Github, I forked my friend's repository to work on some of the code. I cloned the fork to my computer and added the upstream remote so I could update my repository with his. Now when I view my branches with git branch
in Git Shell, it shows 5 branches: my own master, 2 from upstream, and then 2 more. These two are the same as the two upstream ones, but instead of "upstream" it says my friend's name. What's the difference between these two branches and the two upstream branches?
Asked
Active
Viewed 226 times
2

Rohan Khajuria
- 636
- 2
- 12
- 26
-
Perhaps `git branch -av` tells you more? – Christoph Jul 24 '17 at 05:55
1 Answers
0
Here is what I see after cloning a fork and adding upstream (original repo)
vonc@VONCAVN7 D:\git
> git clone https://github.com/VonC/gitpitch-docker
Cloning into 'gitpitch-docker'...
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 13 (delta 3), reused 13 (delta 3), pack-reused 0
Unpacking objects: 100% (13/13), done.
vonc@VONCAVN7 D:\git
> cd gitpitch-docker
vonc@VONCAVN7 D:\git\gitpitch-docker
> git remote add upstream https://github.com/fukusukei/gitpitch-docker
vonc@VONCAVN7 D:\git\gitpitch-docker
> git fetch upstream
From https://github.com/fukusukei/gitpitch-docker
* [new branch] master -> upstream/master
vonc@VONCAVN7 D:\git\gitpitch-docker
> git br -avv
* master a21fb40 [origin/master] update
remotes/origin/HEAD -> origin/master
remotes/origin/master a21fb40 update
remotes/upstream/master a21fb40 update
You should see branches starting with origin (your fork) or upstream (the original repo).
By default, cloning a fork shows remote branches as origin/xxx
.
But if git branch
(not git branch - r
or -a
, so local branches only) shows you jenilajmera/xxx
branches, that simply their names: you can name a branch with a '/
' in it.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
-
-
@RohanKhajuria That is the name of local branches apparently. (https://stackoverflow.com/a/2527436/6309) Check instead the output of `git branch -avv` – VonC Jul 24 '17 at 06:41