Using Git to Manage Development
Git is a distributed RCS which provides a great deal of power and flexibility, especially when developing in large groups, though the development practices it eschews can certainly help in organizing ones efforts.
A New Repository
mkdir project_name
cd project_name
git init
This creates a Git repository inside of project_name, an empty directory.
Saving Changes
Once you've sufficiently edited and saved documents inside of the project folder, you'll have to add them to the Index so that we can save all of the changes to the repository. Here is an example:
git commit -a -m "Added xxx."
If you've created new files, you'll need to add them to the Inded with:
git add .
You can alternately specify files individually (separated by spaces or added one at a time) or subdirectories.
Good/Common Practices
Here are some notable practices that the Git community uses.
Topic Branches
Git handles branches very cleanly while still providing a great deal of power. Branches can be created and remain completely on the local side of the repository, used only to separate non-related edits (and to help with focus). In order to switch to a new branch from the master branch:
git checkout -b branch_name
This will create a new branch called branch_name with whatever contents are currently in the master branch.
One of the key points of this method is to name your branches appropriately: if you are adding an authentication system, label your branch authentication. This helps you keep track of what the goal is for those edits.
To merge changes from the newly created branch name back into the local copy of master, do the following:
git checkout master
git merge branch_name
And to push those changes back to the home repository:
git push origin master





