When I heard a 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.
Git for the 5-year-old
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 best but it looked horrible after you finished it. With Git, you can revert 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. (Source)
This article will explain how we can leverage the power of Git as a beginning programmer.
Leverage online tutorials
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.
Rollback a mistake
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.
Learn to break things down
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 helps devising a bird-eye-view plan. The clear directional plan saves 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.
Revision made easy
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
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, but it is also the learning accelerator for beginners.
Git stores versions of code as a reference that helps speeding up learning and revision. It also encourages trial-and-error and trains us to plan before we code.
Where to start: The visual and interactive way to learn Git.
Before you go: How do you use Git as a newbie?
Originally published at: www.beyondwantrepreneur.com
If you like my handwriting, here are a few more: