Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git cannot find branch in my local project

Tags:

git

github

I can t find the branches after forking and cloning the git project..I have created I remote called upstream and after fetching it and typing git branch -a I get

* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/docs
  remotes/origin/master
  remotes/upstream/develop
  remotes/upstream/docs
  remotes/upstream/master

But I can t find the branch folders of the original project. Any ideas..?

like image 398
John K. Avatar asked Feb 14 '23 23:02

John K.


1 Answers

The general (command line) syntax to switch to a remote branch is:

git fetch origin
git checkout -b someBranch origin/someBranch

A little more background on branches. As you noticed, branches aren't stored in folders. Git actually stores information as deltas - changes from a given set of files, ie the master branch. When you checkout a branch, you are actually telling git to retrieve the specific set of deltas pertaining to this branch and apply them to the current set of files.

SVN, which is another version control platform, by comparison stores its branches in a directory-like structure, but also takes up more space.

like image 145
mikedugan Avatar answered Feb 17 '23 00:02

mikedugan