Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed GitHub Basics!
You have completed GitHub Basics!
Preview
Branching allows you to work on multiple versions of your code at once, meaning you are free to experiment until you are ready to commit.
Further reading
Git Commands:
-
git branch: list out branches
-
git branch [branch-name]: create a new branch
-
git checkout [branch-name]: switch to the newly created branch
-
git checkout -b [branch-name]: shortcut! - use this command to create & switch to the new branch
- git push origin [branch-name]: push branch & changes to GitHub
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
It's an exact copy of the original
branch as it was at that point in time.
0:00
This means you're free to experiment and
commit changes,
0:00
safe in the knowledge that your new branch
won't be merged until you're ready.
0:02
Let's create a branch to
work on the readme.md file.
0:06
In the console, we'll type git branch and
0:10
the name of the branch we would
like to create, add-readme.
0:13
Branch names cannot contain spaces, so
0:18
we generally use the hyphen to
separate words in our branch names.
0:20
Now when we type git branch,
we see the name of our new branch, but
0:24
we're still checked out to master.
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up