Git Town Skill - Usage Guide
This skill helps you execute Git Town workflow commands for efficient branch management in the current repository.
How to Use
Automatic Invocation
The skill is automatically invoked when you mention any of these terms in your chat:
-
Branch Creation:
git town hackhackcreate branchnew branchstart featurefeature branch
-
Branch Syncing:
git town syncsyncupdate branchpull from mainmerge mainsync branch
-
Branch Shipping:
git town shipshipmerge to maincomplete branchfinish featureship branch
-
General Git Town:
git townbranch managementgit workflow
Manual Invocation
You can also manually invoke the skill by typing:
/git-town
Then describe what you want to do (e.g., "create a branch called add-user-auth" or "sync my current branch").
Examples
Creating a Feature Branch
I want to hack a new branch called add-user-authentication
or
git town hack add-user-authentication
The agent will:
- Execute
git town hack add-user-authentication - Create the branch from
main - Switch to the new branch
- Confirm the branch was created
Syncing Your Branch
sync my current branch
or
git town sync
The agent will:
- Execute
git town sync - Pull latest changes from
main - Merge them into your current branch
- Push the updated branch to origin
- Confirm the sync completed
Note: This must be run from within a feature branch (not from main).
Shipping Your Branch
ship this branch to main
or
git town ship
The agent will:
- Execute
git town ship - Perform a squash merge (preserving all commit messages)
- Merge the branch into
main - Delete the branch locally
- Delete the branch on GitHub
- Push
mainto origin - Confirm the branch was shipped
Note: This must be run from within the feature branch you want to ship.
Workflow Commands
1. git town hack <BRANCH_NAME>
Purpose: Create a new feature branch from main.
When to use:
- Starting work on a new feature
- Beginning a bug fix
- Starting work on a task or improvement
Example:
git town hack fix-login-bug
What happens:
- Creates a new branch from
main - Switches to the new branch
- Sets up tracking relationships
2. git town sync
Purpose: Update your current branch with the latest changes from main.
When to use:
- Before shipping your branch (recommended)
- When you want to incorporate latest changes from
main - Periodically during development to stay up-to-date
Example:
git town sync
What happens:
- Pulls latest changes from
main - Merges them into your current branch
- Pushes the updated branch to origin
- Handles conflicts if they arise
Requirements: Must be run from within a feature branch (not from main).
3. git town ship
Purpose: Complete your work and merge the feature branch to main.
When to use:
- When your feature is complete and tested
- When you're ready to merge to
main - After syncing your branch (recommended)
Example:
git town ship
What happens:
- Performs a squash merge (keeps all commit messages by default)
- Merges the branch into
main - Deletes the branch locally
- Deletes the branch on GitHub (remote)
- Pushes
mainto origin
Requirements: Must be run from within the feature branch you want to ship.
Typical Workflow
The standard development workflow follows this pattern:
-
Start work:
git town hack <BRANCH_NAME>git town hack add-dark-mode -
Make changes: Edit files, commit changes as usual
git add . git commit -m "feat: add dark mode toggle" -
Stay updated (as needed):
git town syncgit town sync -
Complete work:
git town shipgit town ship
Configuration
The repository's Git Town configuration is stored in git-town.toml (main branch, ship strategy, perennial branches, forge, etc.). If the project uses Git Town, that file will already exist; otherwise the user can add one. This skill does not assume any specific branch names or strategies beyond what Git Town documents.
What the Skill Does
✅ Executes Git Town commands directly
✅ Creates feature branches from main
✅ Syncs branches with latest main changes
✅ Ships branches to main with squash merge
✅ Handles branch cleanup (local and remote deletion)
✅ Pushes changes to origin automatically
✅ Provides clear feedback on command execution
What the Skill Does NOT Do
❌ Make code changes
❌ Commit your changes (you still commit manually)
❌ Resolve merge conflicts automatically
❌ Review your code
❌ Run tests before shipping
The skill only executes Git Town commands. You're still responsible for:
- Making and committing your code changes
- Resolving merge conflicts if they occur
- Testing your code before shipping
- Reviewing your changes
Tips
-
Always sync before shipping: Run
git town syncbeforegit town shipto ensure your branch is up-to-date withmain -
Use descriptive branch names: Choose clear, descriptive branch names that indicate what you're working on
- ✅ Good:
add-user-authentication,fix-login-bug,improve-error-handling - ❌ Avoid:
test,fix,update,changes
- ✅ Good:
-
Commit frequently: Make regular commits as you work - they'll all be preserved in the squash merge
-
Test before shipping: Make sure your code works and tests pass before running
git town ship -
Handle conflicts promptly: If
git town syncencounters conflicts, resolve them before continuing -
Check your branch: Make sure you're on the correct branch before running commands (especially
ship) -
Don't ship from main: Never run
git town shipfrommainor perennial branches - only from feature branches
Error Handling
If a command fails, the agent will:
- Show you the error message
- Explain what went wrong
- Suggest how to resolve it
Common issues and solutions:
- Uncommitted changes: Git Town will stash them automatically (if configured)
- Merge conflicts: Resolve conflicts manually, then retry the command
- Branch already exists: Use a different branch name
- Not on a feature branch: Switch to your feature branch first
- Remote branch doesn't exist: This is normal for new branches - Git Town will create it
Viewing the Skill
To view this skill in Cursor:
- Open Cursor Settings (Cmd+Shift+J on Mac, Ctrl+Shift+J on Windows/Linux)
- Navigate to Rules
- Look for git-town in the Agent Decides section
Additional Resources
- Git Town Documentation: https://www.git-town.com/
- Configuration File:
git-town.tomlin the repository root - Git Town Configuration Docs: https://www.git-town.com/configuration-file