Git is a distributed version control system for managing source code.
Ok, so what is version control? Simply put, version control is a system for tracking changes to files. As you modify files, the version control system records and saves each change. This allows you to restore a previous version of your code at any time.
Without a version control system, you are stuck manually saving multiple versions of your file using different dates and/or names (e.g. 12-02-2016-monkey_code.php; 12-03-2016-monkey_code.php). This method is time-consuming and impractical when you are dealing with hundreds of files.
Renaming a file also doesn't give you any context as to what changes were made or who they were made by. When multiple team members edit the same file, overwriting may occur and it becomes difficult to keep up with the latest file version.
With Git, you can easily follow your source code's revision history and track changes. You can also go back in time to learn about how the version has changed and who has made the changes. When the latest version of a file is on a shared repository, Git will prevent unintentional overwrites by anyone on your team who has an older version of the file.
A version control system like Git makes it easy to:
- Keep track of code history
- Collaborate on code as a team
- See who made which changes
- Deploy to staging or production