Ravindra BagaleCourses & study guides

Chapter 3: Branching, Merge and GitHub PRs

3.3 Feature-branch workflow (the daily loop)

This is the habit companies expect from juniors.

  main ----o------------------------o---- (stable)
             \ /
              o----o----o feature/health
                   PR + review + merge

Why. main should stay green and shippable. Experiments live on feature branches.

Tiny example. Add a health endpoint on feature/health, open a pull request, get a review, merge, delete the branch.

Steps — feature branch to merge (local first)

  1. From main, create feature/health and switch to it.
  2. Edit the app: add a simple health response (for example return {"status":"ok"}).
  3. git status → git add the file → git commit -m "Add health check endpoint".
  4. Switch back: git switch main.
  5. Merge the feature into main: git merge feature/health.
  6. Confirm with git log --oneline --graph -5.
  7. Delete the finished branch: git branch -d feature/health.

What you see: the graph shows the commit on the feature line joined into main. Your health file exists on main after the merge.

Later you will push the branch and merge through GitHub instead of merging only on the laptop. The idea is the same: review first, then join histories.

Ravindra Bagale's Tip

Khup students feature branch var pahila commit nahi kartat aani main shi compare kartat — empty PR. Kamala lagnya adhi ek meaningful commit zala pahije. Dhyan rakho!