HTML and CSS Reference
share his or her code, another developer can clone the repository to their
machine, which will contain every change from the original repository.
Git is a distributed SCM system. More often than not, Git repositories will have
one main remote repository where all developers will push and pull changes to
and from. The advantage of systems such as Git is that you can work on a
project without a network connection, but still commit changes to your local
repository as you work on a project. Once you have network access, you can
then pull and merge any changes, test them, and then push your merged
changes up to the remote repository. This is particularly helpful if you have a
central build system.
SCM also provides you with the ability to store comments with every commit so
that as you go through a project commit history, you can see who committed
changes to which files and the reason behind each commit. SCM systems such
as Git require commit comments by default, whereas SVN does not. Git is very
popular within the development community, which is why it will be the focus of
Branching and Tagging
Most SCM systems follow a methodology of branching and tagging. The master
branch in Git is the main code base; this is usually always production-ready and
contains the most up-to-date version of the project's code. When a new feature
needs to be added, a branch is usually created from the master branch. These
are usually code-named; some development teams use names from popular
cartoon shows such as Peter, Meg, or Stewie, and others use planet names
such as Saturn, Jupiter, or Mars. You can use any naming convention you like,
as long as each branch has a unique name. What's important is the comment
you make when creating a branch. It must be clear what the branch is for and
what it should contain.
The branch is simply a copy or snapshot of the master branch so that any new
features do not interfere with the production-ready code. Usually, the master
branch is periodically merged with the new branch. This is to ensure that any
changes to the main codebase are compatible with changes to the features in
the branch. After the features in the new branch have been implemented and
tested, it is then merged with the master branch, ready for production.
A tag is simply a significant snapshot of your project's master branch that you
would like to keep for future reference. These are usually significant versions of
your project. This can be useful if other developers are constantly working on
the main branch and you would like to make a working deployment.