If you work in a team or you want to work in a team, collaboration is very important. Should you have experience working in teams for some time now, you will know the frustration that comes with file sharing. When a group of people are working on the same web design project, it becomes almost impossible to avoid chaos if you do not have a version control system in place. Merging front-end templates and back-end functionalities can be scary and almost hard to achieve if you do not have the rights for guidance. That is why you might should make use of Git. Git is an excellent version control system.
Version control also referred to as revision control and source management control is a great way to overcome all the file sharing problems. Version control is based on the fact that there is just one repository for all the project files. When team members check files out and make changes on them for instance, they check them back in (committing them). The version control system will automatically take note of the changed files, when they were changed and the changes that were made on them.
The system will even ask you to make comments about the changes you have made in order for everyone working on that project to know at a glance what you have done and your reasons. In the end, each file will have a revision history and team members can go back to the previous version of any file in case something goes wrong after all the changes.
A good version control system will even allow you to merge all the changes to the same file. This happens if two people are working on the same file at the same time. When the file is pushed back into the main repository, the system will merge both the sets and come up with a new file that is fully updated. In case of any problems during such a merge, the system will highlight it for both team members.
Why is a version control system important?
• It ensures that your files will not be overwritten
• All your latest files will be held in a common repository making them easier to access
• Team members can work on the same files at the same time without experiencing any conflicts
• You can always go back to an old version of the file if there is need to
• Your developers can work easily, promoting satisfaction for developers who are working together on the same project.
Git is new, and one of the favorites of many web developers.
It has gained a considerable amount of popularity in a short period of time probably because of its strong Linux fan base, the Rails community and above all, GitHub. It is a free and an open source VCS. One of the things that set it apart from all the other version control systems in use today is that it is a distributed version control system. This means that every user will have a complete copy of every repository data locally stored on their computers. This is beneficial in so many ways, for instance:
• Everything will be available locally, therefore you can work offline
• Chances of failing in case of crashes and burns are minimal, because it does not rely on one central server. You are therefore assured of the safety of your projects
• Processes run much faster, because it does not have to community to a central server.
The very first thing you need to do is to have Git installed, then you can start creating your own repository. There are different ways through which you can get it, two of the major ones being installing it from the source and installing an existing package for your platform. The best way is to install it from the source, because this is the only way you can be sure to get the most recent version. Each of its versions includes very useful UI enhancements, therefore getting the most recent version will leave you with a software you will be comfortable working with. There are libraries that Git depends on, which you will also need in order to install it: zlib, openssl, libicony and expat.
After its installation, you might need to customize your Git environment a little. This is done only once and the changes will stick around between all the upgrades you will make on your software. You can also change the settings any time you want by running the commands once again. For this, you will use a tool that comes with Git, called
git config which will allow you to set configuration variables that will control all the aspects of how your software will look and operate.
Set your name and email address as well, because this is the information that every Git commit will use. This should be done once too, and Git will always use the information for anything that you will do on the system.
You can now create a Git repository. You can turn an existing folder into a Git repository to achieve this. This can be done using the commands below, which can be found in your Terminal or Command Prompt window:
git add .
With these commands, you are telling the system to initialize this directory add everything in it and this includes all the files and subdirectories, and then commit and store all the changes in the repository.
Important key terms you should know
1. Commit: also called a revision. This is an individual change to a file.
2. Collaborator: a person with a read and write access to a repository file.
3. Contributor: a person who has contributed to a project.
4. Diff: this is the difference in the changes between two commits.
5. Issue: this is a suggested improvement, task or question related to a repository.
6. Merge: This is the process of taking changes from one branch and applying them into another but in the same repository.