Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialGabriel D. Celery
13,810 PointsIssue with remote branch after cloning github repository
This might be something I don't remember from the git course, but I ran into an issue I don't understand.
So in this course after cloning the repo with the command "git clone https://github.com/hdngr/treehouse-express-basics.git express-basics" if I check out the branches with "git branch" I only see the master branch.
But if I do "git checkout addingRoutesToTheApp" then git switches me to the branch and now I can see both the master and the newly added branch. How's that?
1 Answer
Sue Dough
35,800 Pointsgit branch will show the branchs you have on your machine. You have given git no arguements and you only downloaded the master branch when doing git clone.
It sounds like your looking to see the ones locally as well as remotely so you need to pass in the -a arguement.
git branch -a
Expected output
* master
remotes/origin/HEAD -> origin/master
remotes/origin/addStaticToLayout
remotes/origin/addingPartials
remotes/origin/addingRoutesToTheApp
remotes/origin/admin-addons
remotes/origin/easilyDebugExpress
remotes/origin/final
remotes/origin/improvingYourFirstAppSomeFinalTouches
remotes/origin/interactiveDebuggingAndExploratoryProgramming
remotes/origin/listsInJadeTemps
remotes/origin/logicInJadeTemps
remotes/origin/master
remotes/origin/requests
remotes/origin/responseRenderMethod
remotes/origin/responses
remotes/origin/settingUpStaticServer
remotes/origin/usingJade
remotes/origin/whatIsJade
remotes/origin/whereFromHere
remotes/origin/yourFirstExpressApp
git checkout addingRoutesToTheApp will first see if you have it locally and if you don't, it will fetch it remotely.
Now if you switch back to master and type git branch it will show
addingRoutesToTheApp
* master
because you passed no arguements and these are the only 2 branches on your local machine.
Gabriel D. Celery
13,810 PointsGabriel D. Celery
13,810 PointsThx, I didnt know the cloning process only cloned the master branch. Now it all makes sense.
Brigette Eckert
16,957 PointsBrigette Eckert
16,957 PointsThanks that clears some things up.