Creating a branch with git

Just go into the root directory of your project and type in:

git checkout -b branch1

That’s all. Now your created a new branch with the name “branch1”. Your working directory is now the branch.
You can commit your changes like this:

git add .
git -a -m "my changes"

After the commit you can switch to the master with this command:

git checkout master

Now you are again on the master branch. If you want to merge your two branches you can do it in this way:

git mege branch1

Published by Robert Reiz

CEO @ VersionEye. Passionated software developer since 1998.

3 thoughts on “Creating a branch with git

Leave a Reply

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

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

Facebook photo

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

Connecting to %s

%d bloggers like this: