Skip navigation

For Part 2 of our 60-second Git tutorial, we’ll look at some super simple branching and merging.

git branch tells you which branch you’re on. git branch -a lists all branches, even remote ones.

git checkout mybranch checks out the branch you want.

git checkout -b newbranch creates a new branch from the one you’re on, and checks it out for you.

git checkout master && git merge mybranch merges changes from one branch to your master branch. If you don’t want to commit the changes, you can do git merge --no-commit mybranch instead.

So far, we’ve only talked about local git usage. Isn’t it cool that you can do so much without even having a server set up with our repo? I think so.

Part 3 will include pulling and pushing your changes to remote repos.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: