Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Development Tools Creating a Project Pages Site

Luke Kennedy
Luke Kennedy
11,661 Points

git checkout -b gh-pages

What does the "-b" mean with this command?

1 Answer

Nicholas Pretorius
Nicholas Pretorius
18,671 Points

Hi Luke,

The -b in this context is shorthand which instructs Git to do the following in one command:

  • Create a new new branch with the specified name (gh-pages in your example)
  • Checkout the newly created branch with the specified name

It is functionally equivalent to running:

  • git branch gh-pages

And then running:

  • git checkout gh-pages

See a list of flags and descriptions here from the Git docs.

Hope this helps