What do you get from git?
A brief introduction to the benefits of git and GitHub
June 14, 2015
Aspiring web developers certainly have no shortage of languages they need to learn. From the foundational languages of HTML and CSS to the ubiquitous JavaScript, which grants websites the gift of interactivity, and finally to the back-end frameworks that do all the dirty work behind the scenes, programmers constitute a disproportionally high percentage of polyglots living in the United States today.
Every profession has its own specialized jargon (known to linguists as an “argot,” a word which is pronounced like the title of a fairly recent Ben Affleck movie), and programming is no exception. Whereas financial professionals have “bear” and “bull,” developers have “push” and “pull.”
It is an important part of professional development (regardless of one’s field) to become conversant in the profession’s specialized vocabulary. That’s why beginning developers should commit to learning about version control systems and the specialized terms surrounding them.
Version Control and Git
Imagine for a moment that you’re a writer who is trying write a script for a television show that’s meant to be ground-breaking in a wild, experimental, and unpredictable way. You have lots of crazy ideas about what things potentially should be in the script. Furthermore, you are not at all sure about the order in which all of the discrete plot events should unfold (think Lost). What if there were a way for you to explore different ideas and different pathways for your script while keeping a meticulous record of each version and revision you make on the way? Wouldn’t this make your life easier? This is the idea at the heart of git. Using git gives you access to all the drafts (versions) of the script you compose as you work your way towards a finished product.
Version Control and GitHub
Now imagine that you’re working as part of a team of writers scattered across the country who are all trying together to produce this avant-garde TV script. Everyone has different ideas about what should happen on the show and in what order. So, wouldn’t it be nice if there were some kind of system in place where everyone could try out their ideas for the script, and everyone could easily access and read other people’s drafts without risking accidentally deleting the scenes that the group likes? In essence, this would take the same idea in the first paragraph (keeping careful records of every draft), and expanding it to apply to collaborative situations. This is basically what GitHub does with computer code—it’s an online platform accessible from around the world that allows multiple programmers to see each other’s unfolding work on a complex project without risking the corruption of the “good code,” the part of the program that has already been tested and works like it should.
The Language and the Benefits of Version Control
The benefits of this kind of system are manifold:
- Everyone has instant access to all the versions of the files as they evolve
- It’s not necessary to email the “current version” of the code back and forth whenever minor changes are made—instead once someone completes a revision it is committed as a version and then pushed to GitHub
- Once the group approves of the changes one of the team members has made, these changes can then be pulled into the master draft
- It’s incredibly easy to see the individual line-by-line changes from version to version by diffing the file
- If something goes wrong and the code stops working properly, all of the previous versions are available to revert to, and furthermore, it’s a lot easier to isolate the source of the bug
- Tasks can be divided between team members and their individual changes later merged together to form a new master version (in fact, this is what differentiates git and similar version management systems from other file management systems where users must “check out” a file, which locks it from editing by anyone else in the organization)
Using git and GitHub for version control is an important way to safeguard one’s data, increase the possibilities for collaboration (especially simultaneous collaboration), and begin one’s immersion into the unique language and community of developers.