Git is a distributed version control system for managing source code.
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 likely 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.
It also fails to provide readers with any context as to what changes were made or who they were made by. When multiple team members work on the same file, overwriting can quickly become a problem, and it's often difficult to keep track of which file is the latest version.
And so we turn to version control systems to solve all of these problems (and more.) With Git, you can easily access your source code's revision history and track changes. You can see how the version has changed over time and who has made the changes. Because the latest version of a file is stored on a shared repository, Git can prevent unintentional overwrites by anyone on your team who has an older version of the file.In short, 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 code to staging or production