Skip to content

Latest commit

 

History

History
112 lines (88 loc) · 2.77 KB

File metadata and controls

112 lines (88 loc) · 2.77 KB

Git Branching Workflow Guide

⚠️ IMPORTANT: Never Commit Directly to Main

Always use feature branches for development work. Main branch should only receive completed, tested features via pull requests.

Branch Naming Conventions

Feature Development:

feature/description-of-feature
feature/world-source-switching
feature/addon-synchronization

Bug Fixes:

fix/description-of-bug
fix/world-loading-error
fix/missing-addon-icons

Experiments/Prototypes:

experiment/description
experiment/new-ui-layout
experiment/performance-optimization

Development Workflow

1. Before Starting Any Work:

# Make sure you're on main and up to date
git checkout main
git pull origin main

# Create and switch to a new feature branch
git checkout -b feature/your-feature-name

2. During Development:

# Make your changes, test them
npm run dev  # Use hot reload for development

# Commit frequently with descriptive messages
git add .
git commit -m "feat: add specific functionality"

# Push branch to remote when ready
git push origin feature/your-feature-name

3. When Feature is Complete:

# Make sure all tests pass
npm test

# Push final changes
git push origin feature/your-feature-name

# Create Pull Request on GitHub
# After PR is approved and merged, cleanup:
git checkout main
git pull origin main
git branch -d feature/your-feature-name

Quick Commands

Check Current Branch:

git branch          # List all branches (* shows current)
git status          # Shows current branch in output

Switch Between Branches:

git checkout main                    # Switch to main
git checkout feature/branch-name    # Switch to feature branch
git checkout -b feature/new-feature # Create and switch to new branch

Emergency Fix for "Oops, I'm on Main":

# If you made changes on main but haven't committed:
git stash                           # Save changes temporarily
git checkout -b feature/my-changes  # Create new branch
git stash pop                       # Apply saved changes
# Now commit on the feature branch

# If you already committed to main (but haven't pushed):
git reset --soft HEAD~1            # Undo last commit, keep changes
git checkout -b feature/my-changes  # Create new branch
git commit -m "proper commit message"  # Commit on feature branch

Pre-Commit Checklist

  • Am I on a feature/fix branch (not main)?
  • Do all tests pass? (npm test)
  • Does the app build? (npm run dist)
  • Is my commit message descriptive?
  • Are only relevant files included?

Branch Protection

Consider setting up branch protection rules on GitHub:

  • Require pull request reviews before merging
  • Require status checks to pass (tests)
  • Restrict pushes to main branch