Git

Last Updated: 7/10/2023

What is Git

  • Git is the most popular version control system in the world.
  • A version control system records the changes made to our code over time, in a special database called repository.
  • We can look at our project history and see who has made, what changes, when and why.
  • If we screw something up, we can easily revert our project back to an earlier state.
  • Without a version control system, you will have to constantly store copies of the entire project in various folders. This is very slow and doesn't scale at all, especially if multiple people have to work on the same project, you will have to constantly toss around the latest code by email or some other mechanisms, and then manually merge the changes.
  • So in a nutshell, with a version control system, we can track our project history and work together.
  • Git is the most popular version control system in the world because it's free, open source, super-fast and scalable.
  • Version control systems fall into two categories, centralized and distributed.

Centralized

  • In a centralized system, all team members connect to a central server to get the latest copy of the code, and to share the changes with others.
  • Subversion and Microsoft Team Foundation Server are examples of centralized version control systems. The problem with the centralized architecture is the single point of failure. If the server goes offline, we cannot collaborate or save snapshots of our project. So we have to wait until the server comes back online.

Distributed

  • In distributed systems, every team member has a copy of the project with his history on their machine, so we can save snapshots of our project locally on our machine.
  • If the central server is offline, we can synchronize our work directly with others.
  • Git and Mercurial are examples of distributed version control systems.