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 trial

Development Tools

Having troubles pushing new branch

"Type in the command to push the new branch and changes on it to the remote repository on GitHub"

5 Answers

Antonio Martinez
Antonio Martinez
6,444 Points

I was struggling with this one also, this works for me:

git checkout -b add-readme

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Once you've committed locally, you can push using:

git push <remote> <branch>

If remote were "origin" and local branch was "feature_x", this would be:

git push origin feature_x

This worked for me: git push origin add-readme

This is my first time using this and I assumed hitting the get help button would of attached the question Im having an issue with.

Here is what it is asking me to do.

Let's practice the process of pushing a project to a remote branch on github from start to finish. First, type in a command that will create a new branch named add-readme and automatically switch to it.

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Ah the create and switch:

# In two commands
# create branch
$ git branch add-readme
# switch to new branch
$ git checkout add-readme

# combined in one command
# create and switch
$ git checkout -b add-readme

How do I switch to it?

Ive done "git push origin add-readme" and it says I need to also switch to it using checkout