DEV Community

Wren Summerset
Wren Summerset

Posted on

What is Git?

One of the truly exceptional things about the 21st century is the way that humans have begun to amass human knowledge and how we share it widely. We have evidence of humans doing this as far back as 5000 years ago in Mesopotamia where over 30,000 clay tablets were found in a single collection. There have been unfortunate setbacks like the destruction of the Library of Alexandria, the greatest collection of human knowledge to that date, but ultimately, one of the reasons for human success is this drive to offer education to the collective.

The internet is a truly great library of knowledge (and lets face it, cute cat videos) and its important to protect it. One of the best ways we protect the loss of knowledge is through version control. Git is able to record each iteration of a project and share it.

In Git, there are 3 states your documents can be in. You can think of it in the same way one might prepare to present a theatrical performance. There is the point at which your files and folders are strictly available to you. They haven’t been saved. These are the documents you haven’t deemed worthy of sharing to the great library of humanity. This is similar to learning your lines for a script and determining the best costumes and backgrounds to use in the performance. The advantage to this is that you can test code and check for bugs on your local computer.

When you think you’ve done what is needed for that folder, you’ll take it to the second state, known as the staging area. This is like assembling everyone behind the curtain for the dress rehearsal. You’re making sure each character that is meant to be presented is properly placed and those you won’t be presenting are still tucked safely away from audience view.

The third stage is known as committing. Its taking a snapshot of the current iteration of your project. Git is recording each update you make to these documents, so if you royally screw up... its ok. Breathe, go back to a previous version and start again. Not from scratch, but from experience!

When your folder is ready to place into the library of the internet, your audience has assembled, the lights have gone dim, and the curtain is getting drawn back. This is when you are ready to “push” your project out of your local git space and present it to the wide audience of the world. You have added something (of quality?) to the collective knowledge of mankind. Congratulations!

Top comments (0)