What is git?

What is git?

If you work as a programmer, you almost certainly use git daily. But have you ever wondered what it is exactly?

What is it?

Git is a version control system (VCS) that helps store file changes. But how does it do? And Why is the unique tool to do it?

If you have been in this field for a long time, you know there are alternatives such as CVS and Subversion, but why is git the most used?

Well, it's because of the main characteristics that make it a lot better than the others.

  • Differences in storage: Git stores differences in small file snapshots instead of just the changes made. Why is this important? It speeds up git in multiple operations, such as changing branches, checking differences between commits, or even going back to an older version.

  • Integrity: Git uses checksum before storing or referring to something. This gives the ability to know when there is a change, and it is impossible to make one without git noticing it. This guarantees you that you can't lose information in remote operations

  • Generally adds data: there are a few operations where you delete information from the git database. So, almost every operation is reversible

  • Nearly every operation is local: git downloads its database to your local when you run the git clone command. This makes it possible to make or check changes without needing to be connected to the internet, and it gives speeds to git since it doesn't need a server to respond to make an operation

  • Git states: git manages its operations in three different states:

    • Modified: you modified something, but you haven't committed to the git database

    • Staged: means that you have marked a modified file or files to go into the following commit snapshot

    • Committed: it's been stored in the git local database