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 trialBrian van Vlymen
12,637 Pointsgit pull and push
I have just completed the Git Basics course.
I was wondering if someone would be able to help me with clarifying the following.
I would like to make a new branch on my github.com and I clone https url and paste into my git bash. when I typed git pull (url) and I want to check if the branch is exist but its not exist. why it does not working?
Do I have to back to git bash create new branch and push into my github create new branch? is that only one way?
5 Answers
Nick Ocampo
15,661 PointsYou can also do
git branch -r
to show the branches on your remote repos.
Dave McFarland
Treehouse TeacherIf you created the branch on GitHub, you should be able to pull it down to your computer. However, you need to specify the branch name when pulling:
git pull origin new-branch-name
Brian van Vlymen
12,637 PointsHi, http://teamtreehouse.com/nickocampo2 , I typed git branch -r and there is no available remote repos. the next new command no error.
Hi, http://teamtreehouse.com/davemcfarland , after I created a new branches "style4" on my github. and I am trying to pull from my Github into my bash what I did was that "git pull origin style4".
/user/1pushgit/facebook-icon-webkit (master)
$ git pull origin style4
From https://github.com/ironheartbj18/facebook-icontest
* branch style4 -> FETCH_HEAD
Already up-to-date.
Next is
$ git branch
*master
style
style3
There is no new branch for style4 from Github. It got me suspect.
Dave McFarland
Treehouse TeacherYou should be able to just run git checkout style4
to get the branch. I don't know why but Git isn't listing the new branch but it's there. I've tested this on my own machine and that's how it worked for me.
Brian van Vlymen
12,637 PointsI will try to unstall and reinstall I dont why they don't interaction.
Brian van Vlymen
12,637 PointsI m back to this today and yaya I sloved it. finally I figure it out you were absolutely right! this is help me alot ! thanks
Dave McFarland
Treehouse TeacherDave McFarland
Treehouse TeacherYou also need to run this:
git remote update origin --prune
Before
git branch -r
so that your local repo learns about the remote branches.