惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
Recent Announcements
Recent Announcements
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Microsoft Azure Blog
Microsoft Azure Blog
N
Netflix TechBlog - Medium
人人都是产品经理
人人都是产品经理
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
U
Unit 42
腾讯CDC
D
Docker
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
Vercel News
Vercel News
I
InfoQ
Jina AI
Jina AI
爱范儿
爱范儿
宝玉的分享
宝玉的分享
博客园 - Franky
G
Google Developers Blog
P
Proofpoint News Feed

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Working in Branches
Favor Charles Owuor · 2026-06-01 · via DEV Community

git branches

When I first started using Git, I did everything on the main branch. It seemed easier. I would make changes, commit them, push them, and move on. For solo projects, it didn't seem like a problem.

I failed my first ever interview. I had the first round which was good, then moved on to the second round which was a home assignment. I was tasked to create a simple Django English-Swahili translator. It was simple enough. I created it, and submitted. To me I felt like I had passed.

I sought feedback as to why I failed. There were a bunch of reasons but one of them was that I only worked on the main branch.

From that experience, I decided to start working in branches for every significant and sometimes non-significant task.

What Are Branches?

A branch is an isolated version of your codebase. It allows you to work on a feature, bug fix, or experiment without affecting the main code that everyone relies on.

Think about building a login page. Instead of changing the main branch directly, you create a separate branch and do all your work there. If something breaks, only the branch is affected. The main branch remains safe.

Once the feature is complete and tested, you merge it back into the main branch.

A Typical Branch Workflow

Most development work follows a simple process.

First, make sure your local repository is up to date.

git checkout main
git pull

This ensures you're working from the latest version of the project.

Next, create a branch for your task.

git checkout -b feature-login-page

Now you're working in your own isolated environment.

Make your changes, then check what has been modified.

git status

When you're ready, stage and commit your work.

git add .
git commit -m "Add login page"

The branch still exists only on your machine at this point.

To publish it to GitHub, push it to the remote repository.

git push -u origin feature-login-page

Once the branch is online, you can open a Pull Request.

A Pull Request allows other developers to review your work before it becomes part of the main codebase.

After approval, the branch can be merged into main.

Why Use Branches?

At first, branches can feel like extra work. Creating them, switching between them, and opening Pull Requests adds a few more steps to your workflow.

The benefits outweigh that small effort. The biggest advantage is safety. If a feature breaks, the main branch remains untouched.

Users continue using a stable version of the application while you fix the issue. Branches also make teamwork much easier.

Imagine three developers working on different features at the same time. Without branches, everyone would constantly overwrite each other's changes.

With branches, each person can work independently and merge their work when it's ready.

Another benefit is cleaner code reviews. Instead of reviewing weeks of mixed changes, reviewers can focus on one feature or bug fix at a time. That makes mistakes easier to spot and feedback easier to give.

Branches and CI/CD

If you're using a CI/CD pipeline, branches become even more useful. Whenever code is pushed to a branch, automated tests can run before the code reaches production.

This helps catch problems early.Finding those issues before deployment saves a lot of headaches.

Useful Commands

As you work with branches, a few commands become part of your daily routine.

List local branches:

git branch

List local and remote branches:

git branch -a

Switch to an existing branch:

git checkout branch-name

Temporarily save uncommitted work:

git stash

Delete a local branch:

git branch -d branch-name

You don't need to memorize every Git command. These few commands are enough to handle most day-to-day branch management.

What Happens Without Branches?

Many beginners skip branching because they work alone. The problem appears when projects start growing.
A single mistake on the main branch can introduce bugs into working features.

Testing becomes harder because unfinished work gets mixed with stable code.
Eventually, you're afraid to make changes because every update feels risky.

Branches solve that problem by creating a safe space for development.
You can experiment, test ideas, and fix bugs without putting the primary codebase at risk.

Conclusion

Working in branches is one of the habits that separates small projects from professional development workflows.

It keeps your main branch stable, makes collaboration easier, and gives you the freedom to experiment without fear of breaking existing functionality.

If you're still making all your changes directly on main, try creating a branch for your next feature. Make it a habit. It will boost your productivity and make you more confident in exploring what your projects can do without fear of failure.