StrategyBest forKey structuresGitHub FlowContinuous deployment, small teamsmain + feature branches → PR → deployGitFlowRelease cycles, multiple versionsmain → develop → feature/* → release/* → hotfix/*Trunk-basedCI/CD, large teamsShort-lived feature branches → merge to main dailyGitLab FlowEnvironments per branchmain → pre-production → production
Follow Conventional Commits: <type>(<scope>): <description>
text
feat: add user authentication
fix(api): handle null response from payment gateway
chore(deps): upgrade express to 4.18
docs(readme): update installation guide
refactor(db): extract query builder
test(auth): add login flow tests
bash
git checkout -b feat/my-feature main
# ... code, commits ...
git push -u origin feat/my-feature
# → Open PR on GitHub/GitLab/Azure DevOps
bash
git fetch origin
git rebase origin/main
# fix conflicts if any
git push --force-with-lease
bash
git rebase -i HEAD~3
# pick, squash, reword, edit as needed
git push --force-with-lease
Strategy:
git merge <branch> → resolve conflicts in filesgit add <file>git merge --continueFor rebase conflicts:
bash
git rebase --continue # after resolving each step
git rebase --abort # to cancel
git rebase --skip # to skip a commit
git reset --soft HEAD~1git reset --hard HEAD~1git reflog → find SHA → git checkout -b <branch> <sha>git revert <sha> (safe for shared branches)bash
git config --global alias.lg "log --oneline --graph --decorate --all"
git config --global alias.undo "reset --soft HEAD~1"
git config --global alias.amend "commit --amend --no-edit"
See references/workflows.md for detailed workflow patterns.