← back
Mirage
/
Git
/
Git Flow — Visual Branching
Git
Git
Git Flow — Visual Branching
main, develop, feature, release, hotfix branches as a real SVG diagram with all commands and golden rules.
Branch Map
main
release
develop
feature/login
feature/dashboard
hotfix
v1.0.0
v1.0.1
init
merge login
merge dash
time →
main — production code, always deployable
release — prep for deployment, final testing
develop — integration branch, work-in-progress
feature/* — one branch per feature
hotfix/* — emergency production fix
Daily Workflow
1
Start a new feature
always branch off develop, never off main
git checkout develop && git pull
git checkout -b feature/user-auth
2
Work on the feature
commit often with clear messages using conventional commits format
git add .
git commit -m "feat: add JWT login endpoint"
git commit -m "feat: add protected route middleware"
3
Push and open PR
push branch to remote, open pull request for code review
git push origin feature/user-auth
# open PR on GitHub: feature/user-auth → develop
4
Merge to develop
after review, squash and merge into develop. delete the feature branch.
git checkout develop && git merge --no-ff feature/user-auth
git branch -d feature/user-auth
5
Create a release
when develop has enough features, create a release branch for testing
git checkout -b release/1.2.0 develop
# fix bugs, bump version, update CHANGELOG
git merge release/1.2.0 # into main AND develop
!
Hotfix (emergency)
critical bug in production? branch from main, fix, merge back to BOTH main and develop
git checkout -b hotfix/login-crash main
git commit -m "fix: crash on empty password"
git merge hotfix/login-crash # into main AND develop
Key Commands
⬡ Branching
git
checkout -b
feature/name
# create + switch
git
branch
# list branches
git
branch -d
feature/name
# delete local
git
push origin --delete
feature/name
# delete remote
⬡ Merging
git
merge
feature/name
# basic merge
git
merge
--no-ff
feature/name
# keep history
git
merge
--squash
feature/name
# one clean commit
git
rebase
develop
# replay on top
⬡ Conflicts
git
status
# see conflicted files
# edit files, remove <<< === >>> markers
git
add .
# mark resolved
git
merge --continue
# finish merge
git
merge --abort
# start over
⬡ Undo
git
reset
--soft
HEAD~1
# undo commit, keep changes
git
reset
--hard
HEAD~1
# undo + discard
git
revert <hash>
# safe undo (new commit)
git
stash
# temp save work
git
stash pop
# restore stash
Golden Rules
✓ Do
branch off develop for features
commit small, commit often
use conventional commits (feat/fix/docs)
pull before you push
delete branches after merging
merge hotfix to BOTH main and develop
✕ Don't
push directly to main
work on main branch
commit broken code to develop
use vague messages like "fix" or "wip"
leave stale branches alive for weeks
rebase shared/public branches