· · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · ·
Merging

Three-Way Merge
Merging is how separate lines of development come together. Astral uses a sophisticated three-way merge algorithm that intelligently combines changes and clearly identifies conflicts when they occur.
The Three-Way Merge
When merging two branches, Astral looks at three versions:
How It Works
- Find Base: Identify the common ancestor of both branches
- Diff Both Sides: Calculate what changed in each branch since the base
- Apply Non-Conflicts: Changes that don't overlap are applied automatically
- Mark Conflicts: Overlapping changes are marked for manual resolution
Performing a Merge
Basic Merge
# Switch to target branch
asl switch main
# Merge feature branch
asl merge feature-auth
$ asl merge feature-auth Merging 'feature-auth' into 'main'... Auto-merging src/auth/login.go Auto-merging src/db/users.go ✓ Merge completed: 8f2a1c3d 2 files merged automatically
Merge with Conflicts
When conflicts occur:
$ asl merge feature-auth
Merging 'feature-auth' into 'main'...
Auto-merging src/auth/login.go
CONFLICT (content): Merge conflict in src/config/settings.go
✗ Automatic merge failed
1 conflict needs resolution
Use 'asl status' to see conflicts
Use 'asl resolve' after fixing
Resolving Conflicts
View Conflicts
asl status
# Output shows:
# Unmerged paths:
# both modified: src/config/settings.go
Conflict Markers
Conflicting files contain markers:
<<<<<<< OURS (main)maxConnections = 100=======maxConnections = 200>>>>>>> THEIRS (feature-auth)
Resolution Process
- Edit the file: Remove markers, keep the correct content
- Mark as resolved:
asl resolve src/config/settings.go - Complete the merge:
asl merge --continue
# After editing the file
asl resolve src/config/settings.go
# Continue the merge
asl merge --continue
Merge Strategies
Fast-Forward Merge
When the target branch hasn't diverged:
asl merge feature-auth --ff
# Result: Just moves the pointer, no merge commit
Fast-forward is cleanest when your feature is purely additive and main hasn't changed.
No Fast-Forward
Force a merge commit even when fast-forward is possible:
asl merge feature-auth --no-ff
# Result: Always creates a merge commit
Squash Merge
Combine all commits into one:
asl merge feature-auth --squash
# Result: All changes applied as one commit
Aborting a Merge
If things go wrong:
# Abort and return to pre-merge state
asl merge --abort
Best Practices
Merge early and often. Large divergence leads to complex conflicts.
Always run your test suite after a merge, even if it was automatic.
Merge commits should summarize what was integrated and why.
For feature branches with many WIP commits, squash before merging.