Git Features
Opal’s git implementation supports:- Initialize repositories
- Commit changes automatically
- Create and switch branches
- Push and pull from remotes
- Merge branches with conflict resolution
- View commit history
- Git conflict editor with visual resolution
- GitHub authentication and sync
Repository Initialization
Every workspace can have an optional git repository:Git repositories are stored in a
.git directory within the workspace, just like regular gitCommits and Changes
Opal automatically manages commits for you:Auto-Commit Behavior
Changes are automatically committed in these scenarios:- Before branch switch: Saves work before switching branches
- Before push: Ensures all changes are committed before pushing
- Before pull: Commits local changes before pulling remote updates
- Before checkout: Saves changes before checking out a different ref
opal / to distinguish them from manual commits.
Manual Commits
Manual Commits
You can also create manual commits:
Git Status
View the current repository state:- Uncommitted changes: Files modified since last commit
- Current branch: Active branch name
- Latest commit: Most recent commit hash and message
- Merge state: Whether a merge is in progress
Branches
Manage branches directly from Opal:- Create Branch
- Switch Branch
- Delete Branch
Remote Repositories
Connect your workspace to GitHub:GitHub Authentication
Opal supports multiple authentication methods:OAuth Device Flow
OAuth Device Flow
Best for: Public use, shared computers
- No redirect required
- Token stored in browser
- Easy to revoke from GitHub settings
- Works with 2FA
Personal Access Token
Personal Access Token
Best for: Advanced users, automation
- Full control over permissions
- Stored securely in browser
- Can be scoped to specific repositories
- Requires manual token creation
CORS Proxy
Git operations use a CORS proxy for browser compatibility:- Default proxy:
https://cors.isomorphic-git.org - Configurable per remote
- Required for browser-based git operations
- Can be self-hosted for privacy
The CORS proxy only proxies git protocol traffic, not your file content
Push and Pull
Pushing Changes
Push commits to your GitHub repository:Force Push
Force Push
Force push when needed (use with caution):
Pulling Changes
Sync remote changes to your local workspace:Merge and Conflicts
Merging Branches
Merge one branch into another:- Resolves branch names to commit OIDs
- Attempts automatic merge
- If conflicts occur, enters merge mode
- User resolves conflicts manually
- Creates merge commit when resolved
Conflict Resolution
When merge conflicts occur:The conflict editor shows:
- Ours: Your local changes (current branch)
- Theirs: Incoming changes (merging branch)
- Accept buttons for each section
- Manual edit capability
Conflict Markers
Conflicts appear in source mode with standard git markers:Commit History
View and navigate commit history:- Recent commits: Last 20 commits by default
- Commit details: Author, date, message, hash
- Checkout commits: Time-travel to any commit
- Create branches: Start new branch from any commit
Navigating History
Navigating History
Advanced Operations
Reset Operations
Hard Reset
Hard Reset
Reset to a specific commit, discarding all changes:
Soft Reset
Soft Reset
Move branch pointer without changing files:
Detached HEAD
When you checkout a commit (not a branch):- You enter “detached HEAD” state
- Changes can be committed but aren’t on any branch
- Create a new branch to save your work
- Return to previous branch to exit detached state
Best Practices
Commit Often
Commit Often
Opal’s auto-commit system ensures you never lose work:
- Changes are committed before risky operations
- Edit history provides additional safety net
- Push to GitHub regularly for remote backup
Use Branches
Use Branches
Organize work with branches:
- Keep
mainstable - Create feature branches for new work
- Merge back when complete
- Delete old branches to stay organized
Sync Regularly
Sync Regularly
When collaborating or working across devices:
- Pull before starting work
- Push when you finish a session
- Resolve conflicts promptly
- Communicate with collaborators