October 22, 2018

The GIT version control system - branches

Take a look at this article: Branches are where GIT puts every other version control system to shame.

Git branching works, is easy to use, and is something you should use on a regular basis. Some people say that all new coding should be done in a branch that is merged after testing.

In other version control systems (such as SVN), branches are terrible booby traps that lure you into a swamp full of alligators. If you have negative attitudes based on such systems (and you should!), you should revise them in your work with git.

You make a branch like so:

git checkout -b branch_for_test
This checks out the current repository as a new branch and it makes this the active branch.
git branch
The git branch command is just a status command that shows you all branches and which branch is current.

Merging changed from a branch back to the master:

git checkout master
git merge branch_for_test
The checkout command just switches to the master branch, then the merge command pulls in the changes.
When you are done with a branch, you can delete it via:
git branch -d branch_for_test

Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org