Git Workflow for Professional Developers
Branch Structure
main
└── integration
├── feature/xyz
├── feature/abc
└── fix/bug-123
| Branch |
Purpose |
main |
Production-ready code (stable, tested) |
integration |
Staging area where features are merged and tested |
feature/* |
Individual work branches for new features |
fix/* |
Bug fix branches |
Workflow Steps
1. Start New Work
git switch integration
git pull origin integration
git switch -c feature/my-feature
2. Develop and Commit
git add .
git commit -m "Add feature description"
3. Merge to Integration
git switch integration
git pull origin integration
git merge feature/my-feature
git push origin integration
4. Test
docker-compose up --build
5. Release to Production
git switch main
git pull origin main
git merge integration
git push origin main
6. Tag the Release
git tag -a v1.0.0 -m "First production release"
git push origin v1.0.0
7. Cleanup
git branch -d feature/my-feature
Visual Workflow
feature/xyz → integration → main
↓ ↓ ↓
develop test production
Best Practices
- Never work directly on
main — always go through integration
- Never push to
main without testing on integration first
- Keep features small and focused — easier to review and merge
- Merge early, merge often — small merges are easier than large ones
- Pull before merge — always update your branch before merging
- Update long-running feature branches — merge
integration into your feature branch regularly
Tags are permanent bookmarks to specific commits — used to mark production releases.
| Feature |
Branch |
Tag |
| Moves with new commits |
✅ Yes |
❌ No (stays fixed) |
| Points to latest code |
✅ Yes |
❌ No |
| Marks a specific release |
❌ No |
✅ Yes |
| Creates GitHub Releases |
❌ No |
✅ Yes |
Example:
main → [commit C] → [commit B] → [commit A]
↑
v1.0.0 (stays here forever)
Even after 100 more commits, v1.0.0 still points to commit B.
Version Numbering
v1.0.0 → First release
v1.0.1 → Bug fix (patch)
v1.1.0 → New feature (minor)
v2.0.0 → Breaking changes (major)
| Version Part |
When to Increment |
| Major (v2.0.0) |
Breaking changes, major rewrites |
| Minor (v1.1.0) |
New features, backwards compatible |
| Patch (v1.0.1) |
Bug fixes, small improvements |
When to Tag
| Situation |
Action |
Code tested & merged to main |
Create tag v1.0.0 |
| Hotfix deployed |
Create tag v1.0.1 |
| New feature released |
Create tag v1.1.0 |
Tag Commands
# Create annotated tag
git tag -a v1.0.0 -m "First production release"
# Push tag to GitHub
git push origin v1.0.0
# List all tags
git tag
# Delete local tag
git tag -d v1.0.0
# Delete remote tag
git push origin --delete v1.0.0
Benefits of Tagging
- Rollback easily — if v1.1.0 breaks, checkout v1.0.0
- GitHub Releases — tags become downloadable releases with assets
- Track production — always know exactly which code is live
- CI/CD triggers — many pipelines auto-deploy when a tag is pushed
TIP: Tag it when it hits production! 🚀
Handling Multiple Features
If you need to pause a feature:
# Save current work
git add .
git commit -m "WIP: feature progress"
# Switch to integration, start new feature
git switch integration
git pull origin integration
git switch -c feature/urgent-fix
# When done, go back to original feature
git switch feature/my-feature
git merge integration
Resolving Merge Conflicts
When conflicts occur:
- Open the conflicted file
- Look for conflict markers:
<<<<<<< HEAD
(your branch content)
=======
(incoming branch content)
>>>>>>> branch-name
- Edit to keep desired content
- Delete the markers (
<<<<<<<, =======, >>>>>>>)
- Save and commit:
git add .
git commit -m "Resolve merge conflict"
Vim Keybindings for Conflict Resolution
Modes
| Key |
Mode |
Description |
i |
Insert |
Start editing text |
Esc |
Normal |
Stop editing, navigate |
: |
Command |
Run commands (save, quit) |
Navigation (Normal mode)
| Key |
Action |
h j k l |
Left, Down, Up, Right |
gg |
Go to top of file |
G |
Go to bottom of file |
0 |
Go to start of line |
$ |
Go to end of line |
w |
Jump forward one word |
b |
Jump backward one word |
/text |
Search for "text" |
n |
Next search result |
Editing (Normal mode)
| Key |
Action |
i |
Insert before cursor |
a |
Insert after cursor |
o |
New line below and insert |
O |
New line above and insert |
x |
Delete character |
dd |
Delete entire line |
u |
Undo |
Ctrl+r |
Redo |
Save and Quit (Normal mode)
| Command |
Action |
:w |
Save |
:q |
Quit |
:wq |
Save and quit |
:q! |
Quit without saving |
ZZ |
Save and quit (shortcut) |
Quick Conflict Resolution Workflow
- Press
/<<< then Enter to find conflict markers
- Press
dd to delete the marker line
- Navigate with
j and k to review content
- Delete unwanted lines with
dd
- Delete remaining markers (
=======, >>>>>>>)
- Press
:wq to save and exit