Sitemap
Hadi Hassan

Hadi Hassan

swe | writing about productivity - growth - tech - life experiences (anything that's on my mind)

Git Branching

2 min read6 days ago

🧠 Have you ever thought of how big teams maintain their codebases without conflicting with each other? They use the most popular version-control system: Git — it’s a tool which helps companies maintain big lines of code which tells them who did what and exactly when

But even if companies use Git, still how would they manage multiple people writing hundreds of lines to the same codebase every single day — this is where Git Branching comes in.

Press enter or click to view image in full size
Linkedin Post

♻️ Git Branching is a very useful tool using which you maintain branches to your own project. Consider a branch as a working edition of your code. Your live users see the code living on the “main” branch and you can create other branches as per requirements.

Get Hadi Hassan’s stories in your inbox

Join Medium for free to get updates from this writer.

For the major part, when working on my own, I had been using the “main” branch directly — this meant one wrong commit could break everything (luckily enough these were my own projects) 🌬️

Here’s how Git Branching works:
-every time you’re starting work on a new feature, your first step is to create a new branch. All your code lives on that branch without making any changes to the “main” version
-as soon as you are done with your work, you open a “pull request” on GitHub
-in a real life scenario, there’s often someone who has to review your work before merging it to the live version. Once they do this, they successfully merge your branch’s work to the “main” branch. This way, nothing gets broken 🔝

Why this matters: Well for the most part, you are protecting the “main” branch from any buggy code but another perspective to this is when you’re in a team of multiple engineers working on the same project. Everyone pushing to the main environment means stepping on each other’s feet. Using branches, you stay organized and prevent any problems 🤖

Switch to Git Branching unless you want your manager finding out you’re not aware of it

#softwaredevelopment #git #buildinpublic #learntocode

--

--

Hadi Hassan
Hadi Hassan

Written by Hadi Hassan

swe | writing about productivity - growth - tech - life experiences (anything that's on my mind)