28 Feb 2018
3 min read
When I heard of word version control or Git, I thought of it as a set of command lines that professional programmers use to collaborate with their BIG team on a GIGANTIC code base.
It’s not for me. I’m a newbie. I’ll take another look later.
WRONG! I learned late that Git is the newbies’ learning steroid.
Imagine you are coloring on a flower coloring book. You colored in green for all leaves and now it’s time for the best part, coloring the petal. You know you enjoy red the most but it looked horrible after you finished it. With Git, you can revert to your choice of red in a heartbeat and you are free to reapply the red if you change your mind. A work doesn’t have to be permanent; every action is recorded and reversible.
This article will explain how we can leverage the power of Git as a beginning programmer.
Among the best way to learn to code is to follow the tutorial series of demo projects, type along, and save the code as a reference.
Most tutorials, however, override the code as the series continues. For example, the code from episode 1 gets replaced by the code from episode 2. They leave us with only the latest version of the code.
Git saves all versions of code as a separate commit. Therefore, we will have a variety of references when we develop our own project.
We learn a lot by wrestling with bugs.
Nonetheless, there will be the time when we are stuck. For instance, bug logs are not helpful, Google gives a bunch of irrelevant results, or community supports, such as StackOverflow, don’t understand our problems.
Git creates a checkpoint where we can rollback to, reassess the strategy, and get back in the ring.
Furthermore, a rollback encourages trial-and-error. We experiment with the code, rollback if not satisfied, until we come up with the most elegant solution.
To leverage a rollback, a commit must be small. We would rather rollback 20 lines of code than 200 lines.
Using Git trains us to break a big problem down into small committable units. Breaking things down articulates a thought, thus helps devising a bird-eye-view plan. The clear directional plan can save us from getting lost in the maze of code.
Moreover, it prepares us for collaborative projects in which the submission of a large commit after a long while can cause a merge conflict — commits in one branch conflict with commits in other branches.
How many of us return to the project after a long while and it looks at us as we are a stranger?
“Hey, sweetheart,” — Programmer
“Do I know you?” — Project
“Com’ on! I’ve been away for a while, but I never stop thinking about you,”— Programmer … — Project
“Oh, please. Not again,” — Programmer
I can do this all day, but let’s get back to our business.
Looking at an old project can be bewildering, if not intimidating. The project repository consists of numerous files. Each file contains hundreds, if not thousands, lines of code.
We rub our head and question,
“Where do I start?”
Git gives us the simple answer,
“Start with the first commit and work the way up to where we left off.”
It helps us track the flow of the development, thus speeds up the revision.
Git is not only the powerful tool for large collaborative projects, it is also the learning booter for beginners.
Git trains us to plan before we code, stores versions of code as a reference, speeds up our revisions, and encourages trail-and-error.
Where to start: The visual and interactive way to learn Git.
Before you go: How do you use Git as a newbie?
Ground Floor, Verse Building, 18 Brunswick Place, London, N1 6DZ
108 E 16th Street, New York, NY 10003
Join over 111,000 others and get access to exclusive content, job opportunities and more!