Why and How be Good at Git?

   ∾   4 min read


Have you ever found yourself struggling with Git and not utilizing its full potential? I know I have.

Recently I had the opportunity to enlighten some of my colleagues with Git features that were just right for their situations, and it also served them as inspiration to learn more!
This have motivated me into writing about the importance of improving Git skills and the methods to achieve it.

  • I’ll explain why mastering Git can increase your coding productivity and reduce errors in your development.
  • I’ll also provide you with some practical tips on how to improve your knowledge and skills.

Why to get good at Git?

You might be asking yourself a question:

“I know the basics: pull, branch, commit and push."
"Why bother improving my skills?”

So consider this:

Have you ever been afraid to mistakenly delete and lose your code when merging?
When pulling other’s code?
when using multiple branches?

Have you ever lost some code by misusing Git?
I hope you came here before you did.

Or even worse - are you still making copies of files when you wanna “keep a snapshot of the current state for later..”?
Git is fundamentally a Version Control System (VCS) and was made to mediate this exact problem.

For inexperienced users, using Git can be a double-edged sword.
I have personally came across stories of developers, new to Git,
who have unintentionally lost their progress by executing commands without fully understanding their consequences.

To mitigate the dangers of misusage, It is critical to obtain proficiency,
By knowing the possible caveats and strengths of every Git command you are striving to minimize human error.
Make sure you know how to properly use commands like:

They have the potential to delete parts of your code, and lead to an “Oh crap” moment!

The git reflog can give a better look on things, And in some cases restore deleted commits!

By gaining confidence in your ability to use Git to manage the codebase
you will learn to quickly avoid the common mistakes and that will increase your efficiency,
And in turn also the efficiency of your team!

Having a good knowledge of the various commands makes your: Commits, Branches and PR’s cleaner, better structured and professional-looking!
Commands like git commit --amend and git rebase help your branches to stay nice and clean. Conflict resolution and other tasks will become a piece of cake! It is commonly established: Well-managed Git history allows for easy navigation and tracking!

Your project eventually benefits from your team’s combined Git skills as it’s faster and easier to manage the multitude of branches.
A simple and clean Git history allows for better insight on past commits essentially making it easy to navigate, track and understand the history.

Don’t forget about the importance of good commit messages!


How to get good at Git?

“cool, now i wanna git good! … where do i start?”

  1. The world is your ally:
    Theres no better way to learn something than practicing,
    Contributing to opensource projects on GitHub and other codespaces is easier than ever and many project are looking for contributions. Just search for some topic that interests you, filter by your favorite language (also a good way to practice learning new languages) And start looking at the git tree.. Watch and learn from other developers - is the git tree clear and readable? what makes it so? if not readable then what makes it so?

  2. Hardships drive you forward:
    Every time you find yourself confronted by some git-related situation and your’e not exactly sure how to deal with it
    Consider it as an opportunity to expand your knowledge.
    Seek answers on search engines and experiment with various solutions.

  3. Focused drill down:
    There are various git simulators, games and infographics that offer a simple learning curve by using an interactive visual approach to teach Git. In case you just wanna deep-dive the classic way:
    Reading the official documentation gives out a full autopsy of the commands and their options.

Outro

In the future I may write more posts about Git, about specific commands, and how or when to use them.
Maybe about configuration tips and useful shell aliases. Let me know what you think :)