Archives

MY APPROACH

The right solution, not the biggest solution.

You don't need to know whether your problem needs an API, an automation workflow, a dashboard or a custom application.

Tell me the problem. I'll help figure out a practical way to solve it.

Git Workflow Explained Step by Step

When you first jump into a project, Git can feel like a maze. You commit, push, pull, and suddenly you’re staring at a merge conflict at 2 AM. The good news: a clear workflow saves you from chaos. Here’s a pragmatic breakdown of Git workflow, step by step guide to keeps history clean, prevents conflicts, and makes collaboration less painful.

Why a Workflow Matters

Without a workflow, developers end up committing directly to main, overwriting each other’s changes, or worse—losing history. A structured Git workflow ensures:

  • Clean history

  • Predictable releases

  • Easier collaboration

Always define the workflow before the first commit. It’s not glamorous, but it prevents headaches later.

Step-by-Step Git Workflow

1. Clone the Repository

git clone https://github.com/org/project.git
cd project

This sets up your local copy. Simple, but don’t forget to check remote branches right away:

git branch -r

Create a Feature Branch

git checkout -b feature/login-system

Never code directly on main. Branching isolates your work. Use descriptive names (feature/, bugfix/, hotfix/) so teammates know what’s cooking.

3. Make Commits

git add .
git commit -m "Add login form with validation"

Keep commits small and meaningful. Avoid dumping 500 lines with “misc changes.” Future you will thank you.

4. Push Your Branch

git push origin feature/login-system

Now your work is visible to the team. Push often, even if incomplete, so others can review or help.

5. Open a Pull Request (PR)

This is where collaboration happens. A PR lets teammates review your code before merging. Expect nitpicks like “rename variable” or “add tests.” It’s part of the process.

6. Merge into Main

Once approved:

git checkout main
git pull origin main
git merge feature/login-system
git push origin main

Always pull the latest main before merging to avoid conflicts.

flowchart TD

 A [Clone Repository] --> B [Create Feature Branch]
 B --> C [Make Commits]
 C --> D [Push Branch to Remote]
 D --> E [Open Pull Request]
 E --> F [Code Review & Approval]
 F --> G [Merge into Main]
 G --> H [Branch Cleanup]

Real-World Gotchas

  • Merge Conflicts: They’re inevitable. Don’t panic. Use git status to see what’s broken, fix manually, then git add and git commit.

  • Forgotten Branch Cleanup: Old branches pile up. Run git branch -d branch-name locally and git push origin --delete branch-name remotely.

  • Rebasing vs. Merging: Rebasing keeps history linear, but can confuse juniors. Use merge for team projects, rebase for solo cleanup.

Wrap-Up

Git isn’t just about commands—it’s about discipline. A workflow makes collaboration predictable and less stressful. Start small, enforce branching, and let PRs be the gatekeeper. Once the team gets used to it, Git becomes less of a monster and more of a safety net.

 

Comments

No comments yet. Be the first to share your thoughts.

Leave a comment

RDA
Rashid Anwar
Independent Developer

I’m Rashid, an independent developer focused on practical software solutions for businesses.

HAVE A PROJECT IN MIND?

Let's talk about the problem you're trying to solve.

Share what you need. We can discuss the requirements and a practical next step.

Start a Conversation