Loading...
Loading...
Master Git workflows including GitFlow, GitHub Flow, Trunk-Based Development. Configure branches, merge strategies, and collaboration patterns for team environments.
npx skill4agent add aj-geddes/useful-ai-prompts git-workflow-strategy# Initialize GitFlow
git flow init -d
# Start a feature
git flow feature start new-feature
# Work on feature
git add .
git commit -m "feat: implement new feature"
git flow feature finish new-feature
# Start a release
git flow release start 1.0.0
# Update version numbers, changelog
git add .
git commit -m "chore: bump version to 1.0.0"
git flow release finish 1.0.0
# Create hotfix
git flow hotfix start 1.0.1
# Fix critical bug
git add .
git commit -m "fix: critical bug in production"
git flow hotfix finish 1.0.1# Clone and setup
git clone https://github.com/org/repo.git
cd repo
# Create feature branch from main
git checkout -b feature/add-auth-service
git add .
git commit -m "feat: add authentication service"
git push origin feature/add-auth-service
# Push changes, create PR, request reviews
# After approval and CI passes, merge to main
git checkout main
git pull origin main
git merge feature/add-auth-service
git push origin main
# Deploy and cleanup
git branch -d feature/add-auth-service
git push origin -d feature/add-auth-service# Create short-lived feature branch
git checkout -b feature/toggle-feature
# Keep commits small and atomic
git add specific_file.js
git commit -m "feat: add feature flag configuration"
# Rebase on main frequently
git fetch origin
git rebase origin/main
# Create PR with small changeset
git push origin feature/toggle-feature
# After PR merge, delete branch
git checkout main
git pull origin main
git branch -d feature/toggle-feature# Configure user
git config --global user.name "Developer Name"
git config --global user.email "dev@example.com"
# Set default branch
git config --global init.defaultBranch main
# Configure merge strategy
git config --global pull.ff only
git config --global merge.ff false
# Enable rerere (reuse recorded resolution)
git config --global rerere.enabled true
# Configure commit message format
git config --global commit.template ~/.gitmessage
# Setup branch protection rules
git config --global branch.main.rebase true
git config --global branch.develop.rebase true# Feature branches
git checkout -b feature/user-authentication
git checkout -b feature/JIRA-123-payment-integration
# Bug fix branches
git checkout -b bugfix/JIRA-456-login-timeout
git checkout -b fix/null-pointer-exception
# Release branches
git checkout -b release/v2.1.0
git checkout -b release/2024-Q1
# Hotfix branches
git checkout -b hotfix/critical-security-patch
git checkout -b hotfix/v2.0.1
# Chore branches
git checkout -b chore/update-dependencies
git checkout -b chore/refactor-auth-module#!/bin/bash
# merge-with-strategy.sh
BRANCH=$1
STRATEGY=${2:-"squash"}
if [ -z "$BRANCH" ]; then
echo "Usage: ./merge-with-strategy.sh <branch> [squash|rebase|merge]"
exit 1
fi
# Update main
git checkout main
git pull origin main
case "$STRATEGY" in
squash)
git merge --squash origin/$BRANCH
git commit -m "Merge $BRANCH"
;;
rebase)
git rebase origin/$BRANCH
;;
merge)
git merge --no-ff origin/$BRANCH
;;
*)
echo "Unknown strategy: $STRATEGY"
exit 1
;;
esac
git push origin main
git push origin -d $BRANCH# Developer creates feature
git checkout -b feature/search-optimization
# Make changes
git add .
git commit -m "perf: optimize search algorithm"
git push origin feature/search-optimization
# Create pull request with detailed description
# Reviewer reviews and suggests changes
# Developer makes requested changes
git add .
git commit -m "refactor: improve search efficiency per review"
git push origin feature/search-optimization
# After approval
git checkout main
git pull origin main
git merge feature/search-optimization
git push origin main
# Cleanup
git branch -d feature/search-optimization
git push origin -d feature/search-optimization# .github/branch-protection-rules.yml
branches:
main:
required_status_checks: true
required_code_review: true
dismiss_stale_reviews: true
require_branches_up_to_date: true
enforce_admins: true
required_signatures: false