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 trialNitin Chauhan
444 PointsRemote Origin?
Does pushing changes to Github make Github as "origin" for our local master? I ran git remote on the local master and it showed two remotes --
- The remote we made on our local machine for the original master.
- origin -- my question is regarding this origin.. Is this Github?
Also, what is the difference between git push and git push -u?
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsOrigin is the way github links to your account sand remote repository. So you will set up your remote repository on Github and then Github will give you instructions as to how to push your branch to the remote repository. Once done, your repo is linked to github for as long as it exists there.
git remote origin master
Once done then I can then set up more branches and push them from the command line and it will the show up accordingly on Github.
git push --set-upstream nameOfBranch
And once set up, it's as simple as doing
git push
I'm not 100% clear on the -u flag but i think this is just a shorthand for setting a link to the remote branch. :-)
Kevin Korte
28,149 PointsKevin Korte
28,149 PointsYou're right Jonathan, -u is just shorthand for basically the same thing
If you already have a local branch and want to set it to a remote branch you just pulled down, or want to change the upstream branch youβre tracking, you can use the -u or --set-upstream-to option to git branch to explicitly set it at any time. https://git-scm.com/book/en/v2/Git-Branching-Remote-Branches#Tracking-Branches