Git for juniors

Learn our Git Workflow with me

An interactive guide to practice an environment-based branching strategy: dev for integration, qa for testing and main for production.

Branches by environmentactive: feat/login
Flow of the dev, qa, main and feature branchesThe feature branches off dev, is merged back into dev, and then dev is promoted to qa and qa to main.devqamainfeat/loginhotfix/*
Step 1 of 617%

Current stage

The feature branches off dev

Every feature starts from dev, the integration branch. Use explicit names like feat/login, fix/..., chore/... or hotfix/... depending on the kind of work.

Commands
$ git checkout dev$ git pull origin dev$ git checkout -b feat/login

Practice mode

Terminal simulator

command 1/6

$ waiting for command...

Type or pick the right command to move forward.

Special case

Emergencies

When there's an emergency in production, a hotfix/* branch is created from main. Once it's resolved, it goes back to main and also to dev so the fix isn't lost in the normal flow.

Hotfix
$ git checkout main$ git pull origin main$ git checkout -b hotfix/payment-timeout$ # fix -> commit -> PR/merge into main$ # then merge the hotfix back into dev

Final check

Mini-quiz

0/5 correct
1. Which branch should a regular feature branch off from?
2. What do you do before opening the Pull Request?
3. Which branch does a feature PR target?
4. How does work reach production?
5. Where does an emergency hotfix branch off from?