For all that is good, use Git

Don’t be a noob, git gud

This article isn’t going to teach you Git, GitHub, or explain its concepts to you – it is to emphasise the why and how.

Version Control

Imagine you’re creating an group report on a word doc – how do you work together? Do you split different sections and combine later? What if multiple people need to work on a complex section?

Google docs popularised the collaborative editing feature – and it helps solve a lot of problems in collaboration.

Unfortunately, as a function of how most programs and scripts are written – software development rarely uses collaborative editing. You are likely to run into errors if two brains are working on the same script while taking even slightly different approaches.

So instead of live collaborative editing – Version Control Systems are used to mitigate those challenges in collaboration.

Essentially, Version Control provides a useful way of combining the work of different people on the same project asynchronously. It also provides time machine capabilities which is handy in the ‘anything can go wrong’ world of software engineering.

Git is a version control system, while GitHub is the most popular platform that uses it under the hood. I use Git/GitHub/version control interchangeably in this article – but note that they are related but different concepts.

What I see in uni students and in hackathons, and reasons why

Unfortunately, we live in a weird world where version control knowledge and skills are only learnt when needed – a reactive response rather than proactive.

Often, in many hackathons – I find hackers who have a GitHub account but don’t really use it. And they often don’t know the basic git collaboration flow. In the circumstances I team up with such hackers – it’s always painful.

Lesson

anyone who doesn’t know or want to use version control properly is not someone you want to work with. It’s a red flag 🚩 to many things beyond.

In a recent hackathon while working with strangers who spoke English as a 2nd language,

  • twice, my contributions to the codebase were overwritten entirely (including history, so no remote recovery)
  • 4 times, I offered to teach proper github usage for teams and it wasn’t taken up
  • 10+ times, I asked about fixing version control problems (no .gitignore, no dependencies stated, no branching, multi-repo flows, history erased…etc)
  • 3 times, I asked why we weren’t using GitHub in a good way and the question was dodged
  • Once, I was answered when the ‘main’ developer decided their code wasn’t working 2am before the multi-week deadline and shared their code via single files in the group chat – “Oh, I just don’t know how” 😵

**Factors observed that make the possession of version control skills less likely:

  1. the more junior a uni student is
  2. the less group project experience someone has
  3. the less or no legit industry experience someone has
  4. the less serious a coder someone is
  5. the greater the focus on machine learning/data science

Just like most other knowledge work, the real-world application of software engineering involves working with others. And version control is a key system used to facilitate that.

It’s insane to me how proper git usage isn’t strictly embedded into all curriculums for a CS/SWE student in first-year, but rather they learn it later when the situation demands it or perhaps by taking some workshop run informally by a club.

Why is it so uncommon to find basic git, GitHub and version control skills? Here’s some possible reasons related to above factors:

  1. Lack of reason to: a more junior student hasn’t encountered a situation that strictly requires it. Most early CS courses involve solo-work and not group-work.

  2. Doesn’t see usefulness in Individual Work: group work demands some form of version control. However, I’d strongly argue that GitHub use for individual work is valuable. To track your work, have time machine features, documentation, showcasing, and even CI/CD and other useful integrations to improve the workflow and robustness.

  3. No relevant industry experience: Legit industry experience would involve working in a team where experienced engineers are using GitHub, often a great way to learn the ropes in a real-setting. In an industry team I worked with, they were using bloody Microsoft Sharepoint as the version control system – I had to introduce GitHub to them. I’d count Sharepoint as a non-legit version control method.

  4. Non-legit coder / CS student that actually doesn’t like coding:

    • Basically, the problem isn’t external – it’s them 😅
    • The tell-tale sign is the lack of green squares on their GitHub (green squares indicate activity on GitHub)
    • Anyone that’s actually interested and enjoys computer science, software engineering, or building stuff – would come across GitHub and git in some form as they naturally explore the space
    • This can plague even in prestigious universities. Small story: once I hacked with a 2nd/3rd year Stanford CS student, and our hackathon project was the first repository they ever created in their years of having a GitHub account – absolutely zero activity on their profile (even today, that hackathon is still the only instance). As you might imagine, they didn’t code in the hackathon and wanted to be purely the product manager.
  5. Machine Learning/Data Science focus: when I was doing Andrew Ng’s ML course in 2016, I was just saving to file 👉👈 GitHub wasn’t really the thing back then for the ML field. Generally, we used Kaggle, Google Colab later on, and now HuggingFace as the platforms for our work. Those platforms have some form of version control built-in, which removes the need for Git.

the only situations it’s okay to not use version control

  1. You’re a freaking beast 🔥: YOU are the 10x engineer that can carry the entire stack end-to-end. You don’t need team contribution at all. Version control slows you down. E.g. levelsio

  2. Your development stack is unique 👽: when 3 strangers and I did our first VR development project with Unity, an integrated version control system was still a developing Unity feature. It wasn’t possible (or we didn’t know how) to share our work with GitHub as the project files were Gigabytes in size and normal GitHub does not support sharing that file size (need GitHub LFS).

How to git gud

Use the command line rather than any GUI’s

I’d like to thank my good friend Rob, for recommending this to me. Before that, I was using Git via the GUI in VSCode, and it worked – but I had no idea how to unstuck myself when I needed to revert or do anything beyond the simplest branch > make PR > merge flow.

By using the command line, you’re forced to actually have to understand what each step is doing and what happens under the hood. E.g. the GUI push commit button, abstracts 2 commands away from you.

Abstraction by bundling common sets of commands is nice, but knowing what each command does is powerful. As this allows you to chain multiple commands as needed for your needs.

You can revert to 2 commits ago, make a new branch and change the remote, check the logs, do a force revert…etc – while trying to do the same via GUI is less intuitive because there is no understanding behind what’s happening under each button.

Atlassian has a solid guide to learning git, https://www.atlassian.com/git