Git Flow nghe có vẻ phức tạp, nhưng ngay cả khi làm việc một mình, bạn cũng cần một workflow Git rõ ràng để tránh mess. Đây là workflow tôi dùng cho mọi dự án solo.
Branch Strategy Đơn Giản
main # Production code (luôn stable)
develop # Development branch
feature/* # Tính năng mới
hotfix/* # Fix bug khẩn cấp trên production
Workflow Hàng Ngày
# Bắt đầu tính năng mới
git checkout develop
git pull origin develop
git checkout -b feature/user-authentication
# Code xong, commit
git add .
git commit -m "feat: add user login with JWT"
# Merge vào develop
git checkout develop
git merge feature/user-authentication
git branch -d feature/user-authentication
# Deploy lên production
git checkout main
git merge develop
git push origin main
git tag -a v1.2.0 -m "Release v1.2.0"
git push origin --tags
Commit Message Convention
feat: thêm tính năng mới
fix: sửa bug
docs: cập nhật documentation
style: format code (không đổi logic)
refactor: refactor code
perf: cải thiện performance
chore: cập nhật dependencies
.gitignore Cho WordPress
wp-config.php
wp-content/uploads/
wp-content/cache/
.env
node_modules/
vendor/
*.log
.DS_Store
Consistency là chìa khóa. Dù đơn giản, hãy tuân thủ workflow này mỗi ngày!