The Branch Exists Only On The Remote

Learn how to deal with a branch that exists only on the remote repository.

Branch on remote only

It is common to have a branch that exists on a remote repository but not in your local repository. Maybe someone else pushed a branch up or has made a pull request from a branch in that remote repository.


Type the following out to simulate that state of affairs:

1	mkdir git_origin
2	cd git_origin
3	git init
4	echo 'first commit' > file1
5	git add file1
6	git commit -am file1
7	cd ..
8	git clone git_origin git_clone
9	cd git_origin
10	git checkout -b abranch
11	echo 'origin abranch commit' >> file1
12	git commit -am 'cloned abranch commit'
13	git branch -a

Get hands-on with 1200+ tech skills courses.