mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
feat(git): extend source control with worktrees, stashes, conflicts and identities
- Create a worktree from a new or existing branch - Integrate a worktree branch into a target branch by merge commit or cherry-pick, with continue/abort on conflicts - Delete a worktree with keep, delete-local, or delete-local-and-remote branch options, using safe branch deletion for unmerged branches - Add a stash tab (list, push, apply, pop, drop) shared across a repository and its worktrees - Rename and delete branches, optionally deleting the remote branch and updating scheduled base branches - Detect in-progress merge, rebase, cherry-pick and revert operations and hand conflicts to an agent session - Generate commit messages from staged changes with the default model - Add a default git identity and saved per-repository identities written to git config - Unify git error mapping behind a typed error and one route helper; consolidate git mutations and cache invalidation - Update repository docs
This commit is contained in:
1 parent
52b6147ed3
commit
53238a6324
89 files changed
+7704
-793
No files matched your search
@@ -167,6 +167,7 @@ Retrieve the user's full settings and preferences.
|
||||
repoSortMode: 'recent' | 'manual' | 'name',
|
||||
gitCredentials?: [...], // Read-only
|
||||
gitIdentity?: {...}, // Read-only
|
||||
gitIdentities?: [...], // Read-only
|
||||
tts?: {...}, // Read-only
|
||||
stt?: {...}, // Read-only
|
||||
},
|
||||
@@ -193,6 +194,7 @@ The following preference keys can be modified:
|
||||
The following keys are **NOT** allowed and will be rejected:
|
||||
- `gitCredentials` - Git credentials must be managed via the full UI
|
||||
- `gitIdentity` - Git identity must be managed via the full UI
|
||||
- `gitIdentities` - Git identity presets must be managed via the full UI
|
||||
- `tts.apiKey` - TTS credentials must be managed via the full UI
|
||||
- `tts.endpoint` - TTS endpoint must be managed via the full UI
|
||||
- `stt.apiKey` - STT credentials must be managed via the full UI
|
||||
|
||||
+60
-2
@@ -41,7 +41,7 @@ Work on multiple branches simultaneously without switching:
|
||||
|
||||
1. Select a repository
|
||||
2. Click **Create Worktree**
|
||||
3. Enter branch name
|
||||
3. Choose **New branch** (enter a name and pick a base branch) or **Existing branch** (pick a local or remote branch to check out)
|
||||
4. A new workspace is created with that branch checked out
|
||||
|
||||
Worktrees share the same git history but have independent working directories. This is useful for:
|
||||
@@ -50,6 +50,26 @@ Worktrees share the same git history but have independent working directories. T
|
||||
- Working on a feature while keeping main branch accessible
|
||||
- Testing changes without disrupting your main work
|
||||
|
||||
### Integrating a Worktree Branch
|
||||
|
||||
From a worktree's Branches tab, click **Integrate** to bring its commits into another branch:
|
||||
|
||||
1. Choose the target branch. It must be checked out cleanly in another managed worktree, with no uncommitted changes or operation already in progress.
|
||||
2. Choose a strategy: **Merge commit** integrates all commits with a merge commit, while **Cherry-pick commits** replays each commit onto the target.
|
||||
3. Click **Integrate**.
|
||||
|
||||
If the target stops on conflicts, the operation banner appears in the dialog so you can resolve, continue, or abort the integration.
|
||||
|
||||
### Deleting a Worktree
|
||||
|
||||
Deleting a worktree offers three branch options:
|
||||
|
||||
- **Keep branch** - Leave the branch in the parent repository.
|
||||
- **Delete local branch** - Remove the branch from the parent repository.
|
||||
- **Delete local and remote branch** - Also delete the branch from origin.
|
||||
|
||||
**Delete local branch** and **Delete local and remote branch** use a safe delete: if the branch has unmerged commits it is kept (and the remote branch is not deleted either), and a warning names it. Force-delete it from the Branches tab if intended.
|
||||
|
||||
## Source Control Panel
|
||||
|
||||
Access comprehensive git operations via the source control button.
|
||||
@@ -77,10 +97,48 @@ Access comprehensive git operations via the source control button.
|
||||
- List all local and remote branches
|
||||
- Create new branches from current HEAD
|
||||
- Switch branches (checks out the branch)
|
||||
- Delete local branches
|
||||
- Rename a local branch from its actions menu. Renaming also updates the base branch of schedules in every checkout of the same git repository that used the old name. A worktree's folder keeps the old branch name; `ocm` mirroring looks for a folder named after the new branch, so mirroring the renamed branch fails while that worktree exists.
|
||||
- Delete local branches, optionally force-deleting an unmerged branch and, when the branch tracks a remote, also deleting the remote branch. The current branch and branches checked out in another worktree cannot be deleted.
|
||||
|
||||
{ .phone }
|
||||
|
||||
### Stash Tab
|
||||
|
||||
Stash work in progress and restore it later:
|
||||
|
||||
- Enter an optional message and choose whether to include untracked files
|
||||
- **Stash changes** saves the working tree and index
|
||||
- Each stash shows its branch and date, with **Apply** (restore and keep the stash), **Pop** (restore and remove the stash), and **Drop** (delete the stash)
|
||||
- The stash list is shared by a repository and all its worktrees. Apply, Pop, and Drop verify the stash is still the one shown and ask you to refresh if the list changed.
|
||||
|
||||
### Merge, Rebase and Cherry-pick Conflicts
|
||||
|
||||
When a merge, rebase, or cherry-pick stops on conflicts, an operation banner appears at the top of the source control panel:
|
||||
|
||||
- Shows the operation kind and the list of conflicted files
|
||||
- **Continue** finishes the operation once every conflict is resolved
|
||||
- **Abort** cancels the operation and restores the previous state
|
||||
- **Resolve with agent** opens a new session in the repository, primed with the conflicted files, so an agent can resolve them
|
||||
|
||||
### Committing
|
||||
|
||||
Commit staged changes with a message. Press ⌘/Ctrl+Enter to commit without clicking the button.
|
||||
|
||||
#### AI Commit Messages
|
||||
|
||||
Use the sparkle button in the commit box to generate a commit message from the staged changes using OpenCode's default model. Only staged changes are used, and the generated message replaces the current text after confirmation.
|
||||
|
||||
#### Commit Identities
|
||||
|
||||
Configure identities in **Settings > Git**:
|
||||
|
||||
- **Default identity** - Written to Manager's own git config file (`.config/git/config` in the workspace). When the name or email is empty and a GitHub token credential is configured, the missing parts come from the GitHub account. It applies to Manager commits, agent shells, terminals, and scheduled runs without restarting OpenCode. Because it is a global-level git config file, a repository's own identity and, on non-Docker installs, your `~/.gitconfig` identity take precedence over it.
|
||||
- **Saved identities** - Presets that can be applied to individual repositories.
|
||||
|
||||
Each repository has a **Commit as** selector in the commit box. Choosing a saved preset writes it into the repository's local git config (`user.name` / `user.email`), which git shares with all worktrees of the repository (Manager worktrees, OpenCode workspaces, and scheduled-run worktrees). Choosing **Default** removes the repository's local identity. An identity you set yourself in the repository's local git config is respected and shown as **Custom**; the selector asks before replacing it. The selector shows the effective identity and where it comes from (repository, Manager default, git global config, or not configured). Removing a saved preset does not change repositories that use it.
|
||||
|
||||
Sandboxed shells receive the resolved identity for their directory.
|
||||
|
||||
## Diff Viewer
|
||||
|
||||
View file changes with a unified diff format:
|
||||
|
||||
@@ -8,9 +8,12 @@ OpenCode Manager provides a comprehensive web interface for managing OpenCode AI
|
||||
|
||||
- **Multi-Repository Support** - Clone and manage multiple git repos with private repo support via GitHub PAT
|
||||
- **SSH Authentication** - SSH key authentication for git repositories
|
||||
- **Git Worktrees** - Work on multiple branches simultaneously
|
||||
- **Source Control Panel** - View changes, commits, and branches in a unified interface
|
||||
- **Git Worktrees** - Work on multiple branches simultaneously, integrate a worktree branch into another branch, and delete worktrees with optional local and remote branch cleanup
|
||||
- **Source Control Panel** - View changes, commits, branches, and stashes in a unified interface
|
||||
- **Diff Viewer** - Unified diffs with line numbers and change counts
|
||||
- **Conflict Resolution** - Continue or abort merge, rebase, and cherry-pick operations, or hand conflicts to an agent session
|
||||
- **AI Commit Messages** - Generate commit messages from staged changes using OpenCode's default model
|
||||
- **Per-Repository Identities** - A default git identity plus saved presets, written to each repository's git config (shared by its worktrees) for Manager commits and agent shells
|
||||
|
||||
[Learn more →](git.md)
|
||||
|
||||
|
||||
@@ -96,6 +96,6 @@ Besides the explicit **Restart** button, the server is automatically restarted w
|
||||
- **Config import completes** — Importing a standalone OpenCode config into the workspace
|
||||
- **Version upgrade** — After installing a new OpenCode version
|
||||
|
||||
Saving the OpenCode configuration never restarts the server. A change to the merged configuration is written to disk and applied immediately with an OpenCode location reload, which re-reads the configuration, agents, commands, skills, plugins, and `AGENTS.md` for every loaded location without interrupting running sessions. Comment-only edits do nothing, and changes limited to the `mcp` section are applied by the Settings UI through the MCP API. The change is flagged as **restart required** only when the reload fails, for example because the server is unavailable. Changes to how the server process is launched still need a restart: server environment variables, Git credentials and identity, sandbox enforcement, manager token rotation, the server password, and OpenCode version installs. Saving a provider credential, or completing a provider OAuth flow, applies to the running server immediately without a restart, because OpenCode 2 stores credentials in its database and broadcasts the change.
|
||||
Saving the OpenCode configuration never restarts the server. A change to the merged configuration is written to disk and applied immediately with an OpenCode location reload, which re-reads the configuration, agents, commands, skills, plugins, and `AGENTS.md` for every loaded location without interrupting running sessions. Comment-only edits do nothing, and changes limited to the `mcp` section are applied by the Settings UI through the MCP API. The change is flagged as **restart required** only when the reload fails, for example because the server is unavailable. Changes to how the server process is launched still need a restart: server environment variables, Git credentials, sandbox enforcement, manager token rotation, the server password, and OpenCode version installs. The default git identity applies without a restart: it is written to Manager's own git config file, which the running OpenCode process and its agent shells already read. Saving a provider credential, or completing a provider OAuth flow, applies to the running server immediately without a restart, because OpenCode 2 stores credentials in its database and broadcasts the change.
|
||||
|
||||
A save is rejected with `409` when the files changed since you loaded them (stale revision), or when it would remove a value that is defined only in a lower-priority source file — removing it from the preferred file would leave the inherited value in effect.
|
||||
Reference in new issue
Block a user