Git Workflow
StableNanx provides powerful shortcuts to streamline your entire git workflow. From checking status to staging, committing with AI-generated messages, and pushing—all with simple, memorable commands.
Quick Reference
All git shortcuts use the r (repo) command:
| Command | Full Form | Description |
|---|---|---|
nanx r st | nanx repo status | Show git status |
nanx r a | nanx repo add | Stage specific files |
nanx r aa | nanx repo add --all | Stage all changes |
nanx r c | nanx repo commit | Commit with manual message |
nanx r cgm | nanx repo commit --gm | Commit with AI-generated message |
nanx r pu | nanx repo push | Push to remote |
nanx r pl | nanx repo pull | Pull from remote |
Common Workflows
Standard Development Flow
The most common pattern for daily development:
# 1. Check what's changed
nanx r st
# 2. Stage all changes
nanx r aa
# 3. Commit with AI-generated message
nanx r cgm
# 4. Push to remote
nanx r pu Selective Staging
When you want to commit specific files:
# Stage specific files
nanx r a src/feature.ts src/feature.test.ts
# Or use patterns
nanx r a "src/**/*.ts"
# Commit and push
nanx r cgm && nanx r pu Quick Fix Flow
For small fixes that need to ship fast:
# All-in-one: add, commit with AI, push
nanx r acgmp
# Or with a context hint
nanx r acgmp "fix login validation" Composite Commands
Nanx supports combining commands for efficiency:
| Command | Equivalent To | Description |
|---|---|---|
nanx r acgm | nanx r aa && nanx r cgm | Add all + AI commit |
nanx r cgmp | nanx r cgm && nanx r pu | AI commit + push |
nanx r acgmp | nanx r aa && nanx r cgm && nanx r pu | Add all + AI commit + push |
nanx r acp | nanx r aa && nanx r c && nanx r pu | Add all + manual commit + push |
Working with Branches
Branch Commands
# List branches
nanx r br
# Create and switch to new branch
nanx r br feature/my-feature
# Switch to existing branch
nanx r co main
# Delete branch
nanx r br -d feature/old-feature Feature Branch Workflow
# 1. Create feature branch
nanx r br feature/user-auth
# 2. Make changes and commit
nanx r acgm "implement user authentication"
# 3. Push branch (sets upstream automatically)
nanx r pu
# 4. When done, switch back to main
nanx r co main
# 5. Pull latest changes
nanx r pl Worktree Mode (v0.4.0+)
When working with worktrees, branch switching creates separate directories instead of changing your current state. This lets you work on multiple branches simultaneously.
# Create branch with worktree (copies .env automatically)
nanx r switch -c feature/new-feature
# Copy .env from specific branch
nanx r switch -c feature/new --copy-from develop
# Open in editor after creating
nanx r switch -c feature/new --editor See Worktree Workflow for complete documentation.
Stash Operations
# Stash current changes
nanx r stash
# Stash with message
nanx r stash "WIP: fixing auth"
# List stashes
nanx r stash list
# Apply most recent stash
nanx r stash pop
# Apply specific stash
nanx r stash apply stash@2 Viewing History
# View commit log
nanx r log
# Pretty one-line log
nanx r log --oneline
# Log with graph
nanx r log --graph
# Show specific commit
nanx r show abc1234 Best Practices
1. Check Status Before Committing
Always know what you're about to commit:
nanx r st # Review changes
nanx r aa # Stage all
nanx r cgm # Commit with AI 2. Use AI Messages for Context
Provide hints for better commit messages:
# AI gets more context from your hint
nanx r cgm "fix race condition in session cleanup" 3. Keep Commits Focused
Stage related changes together:
# Good: Related changes
nanx r a src/auth/*.ts
nanx r cgm "implement OAuth support"
# Avoid: Mixed unrelated changes
nanx r aa # (staging 50 unrelated files) 4. Review AI-Generated Messages
Always verify the generated message is accurate before confirming.
Troubleshooting
Uncommitted Changes Warning
# If you have uncommitted changes
nanx r stash # Stash them
nanx r pl # Pull latest
nanx r stash pop # Restore changes Merge Conflicts
# After a pull with conflicts
nanx r st # See conflicted files
# ... resolve conflicts manually ...
nanx r a . # Stage resolved files
nanx r c "resolve merge conflicts" Undo Last Commit
# Keep changes, undo commit
nanx r reset --soft HEAD~1
# Discard changes entirely
nanx r reset --hard HEAD~1 Configuration
Customize git workflow behavior in .repo.yml:
# .repo.yml
repo:
auto_stage: false # Don't auto-stage on commit
push_after_commit: false # Don't auto-push
default_branch: main
commit:
generate_message:
enabled: true
provider: anthropic
model: claude-3-5-sonnet-20241022 Next Steps
- AI Commit Workflow - Deep dive into AI message generation
- Release Workflow - Automated versioning and releases
- All Shortcuts - Complete reference
- Repository Configuration - Customize behavior