Astral provides powerful branch merging capabilities with automatic conflict detection and resolution.
asl merge feature-branchThis will merge feature-branch into your current branch.
When your current branch hasn't diverged from the target branch, Astral performs a fast-forward merge (just moves the branch pointer forward).
# On main branch
asl branch feature
asl switch feature
# ... make changes ...
asl save -m "Add feature"
# Back to main (unchanged)
asl switch main
asl merge feature # Fast-forward!When branches have diverged, Astral creates a merge commit with two parent commits.
# Both branches have different commits
asl switch main
asl merge feature # Creates merge commit$ asl merge feature-branch
✗ Merge conflict detected
Conflicted files:
✗ src/main.go
To resolve:
1. Fix conflicts in each file
2. Run: asl resolve <file>
3. Run: asl merge --continue
Or abort with: asl merge --abort# Edit the file and fix conflicts
vim conflicted-file.txt
# Remove conflict markers: <<<<<<< ======= >>>>>>>
# Keep the correct code
# Mark as resolved
asl resolve conflicted-file.txt
# Complete merge
asl merge --continue# Keep our changes for all conflicts
asl resolve --ours
# Keep their changes for all conflicts
asl resolve --theirs
# Then continue
asl merge --continue# Cancel the merge and restore previous state
asl merge --abortAstral uses standard conflict markers:
our changes here
How to resolve:
- Decide which version to keep (or combine both)
- Remove the conflict markers (
<<<<<<<,|||||||,=======,>>>>>>>) - Save the file
- Run
asl resolve <file>
Create a merge commit even when fast-forward is possible:
asl merge --no-ff featureThis is useful for maintaining a clear history of when features were merged.
Fail if a three-way merge would be required:
asl merge --ff-only feature
# Error: cannot fast-forwardUseful in CI/CD where you want to ensure linear history.
$ asl status
Merging branch 'feature' into current branch
(use "asl merge --abort" to cancel merge)
Unresolved conflicts:
✗ file1.txt (content)
✗ file2.go (content)
Auto-merged files:
● file3.txt
Next steps:
1. Resolve conflicts in each file
2. Mark as resolved: asl resolve <file>
3. Complete merge: asl merge --continue# Create and work on feature branch
asl branch new-feature
asl switch new-feature
echo "new code" > feature.txt
asl save -m "Add new feature"
# Merge back to main
asl switch main
asl merge new-feature
# ✓ Merge completed successfully# Both branches modified same file
asl switch main
asl merge conflicting-branch
# ✗ Merge conflict detected
# Conflicted files: ✗ shared.txt
# Resolve the conflict
vim shared.txt # Fix conflicts manually
asl resolve shared.txt
asl merge --continue
# ✓ Merge completed# Start merge
asl merge feature
# Conflicts detected, but changed your mind
asl merge --abort
# ✓ Merge aborted
# Back to state before merge-
Always check status before merging
asl status # Make sure working tree is clean -
Create a backup branch before complex merges
asl branch backup-before-merge asl merge complex-feature
-
Resolve conflicts in small chunks
- Resolve one file at a time
- Test after each resolution
- Mark as resolved incrementally
-
Communicate with your team
- Coordinate merges of large features
- Review conflicts together when unsure
Make sure the branch exists:
asl branch # List all branchesYou have an unfinished merge:
asl status # Check merge status
asl merge --continue # Or --abortCommit or stash your changes before merging:
asl save -m "WIP" # Commit changes
# Then mergeasl branch- Create and list branchesasl switch- Switch between branchesasl status- View repository statusasl log- View commit historyasl diff- View changes
Astral uses a three-way merge algorithm:
- Finds the lowest common ancestor (merge base)
- Computes changes from base to each branch
- Combines non-conflicting changes
- Marks overlapping changes as conflicts
For more details, see ARCHITECTURE.md.