Docs โบ User โบ Git & Source Control
๐ฟ Git & Source Control
Stage, commit, and push your work โ with AI-generated commit messages โ without leaving Oryn.
Overview
The Git & Source Control panel gives you a full view of your repository's working tree: staged changes, unstaged changes, untracked files, branch status, and recent commit history โ all in one sidebar. You can stage or unstage individual files, discard local edits, write a commit message and commit, and let the AI draft a Conventional Commits message for you based on your actual staged diff. The AI agent also has its own set of Git tools it can invoke autonomously when you ask it to commit, push, review a diff, or scaffold a pull request.
How it works
The desktop Git panel calls into native Electron IPC bridges (`window.oryn.git.*`) to run `git status`, `git log`, `git add`, `git commit`, `git checkout`, and related commands directly against the workspace directory on your machine โ no remote server is involved for those operations. AI commit message generation is handled by a separate backend endpoint (`POST /api/v1/git/commit-message`) that reads your staged diff with `git diff --cached`, intelligently truncates large diffs to stay within roughly 8 000 tokens (capping at 24 000 characters and 80 lines per file), and sends the result to the active chat model with a style-specific system prompt. The AI agent uses a local MCP server (`git-mcp`) over stdio JSON-RPC; that server wraps the `simple-git` library and enforces path and ref validation before executing any git operation, preventing path traversal and shell injection attacks.
What you can do
Working Tree StatusShows staged changes, unstaged changes, and untracked files in collapsible sections, colour-coded by status (M = modified, A = added, D = deleted, R = renamed).
Branch & Divergence DisplayDisplays the current branch name and how many commits you are ahead of and behind the remote at a glance.
One-click Stage / UnstageStage an individual file with the + button, or remove it from the staging area with the โ button, without touching the terminal.
Discard ChangesRevert unstaged edits for a specific file with a guarded confirmation dialog that warns you the action cannot be undone.
Delete Untracked FilesPermanently delete an untracked file directly from the panel, again with a confirmation dialog before any data is removed.
Commit with Keyboard ShortcutType your commit message and press Ctrl+Enter (or Cmd+Enter on macOS) to commit immediately; the Commit button is disabled until at least one file is staged and a message is present.
AI Commit Message SuggestionClick the AI button to generate a Conventional Commits message from your staged diff; the backend truncates oversized diffs gracefully so the request stays within token limits.
Commit Style OptionsThe AI endpoint supports three styles: conventional (Conventional Commits 1.0 format, the default used by the panel), concise (single imperative sentence), and detailed (multi-bullet).
Recent Commit LogA collapsible list of the 10 most recent commits shows subject, short hash, author, and date in the panel without opening a terminal.
Initialize RepositoryIf the open workspace is not a git repository, an empty state offers a one-click Initialize repository action that runs git init.
Agent Git Tools (git-mcp)The AI agent can autonomously run git_status, git_log, git_diff, git_branch_diff, git_branches, git_commit, git_push, git_pr_scaffold, git_github_context, git_github_create_pr, git_github_review, and git_github_autofix_scaffold on your behalf.
Pull Request ScaffoldingThe agent can build a PR body, generate the exact gh pr create command, and โ when GitHub CLI is installed and authenticated โ create the pull request directly.
GitHub PR Review & AutofixThe agent can submit a review (approve, comment, or request changes) and post autofix request comments on pull requests via the GitHub CLI.
Git Safety ValidationAll paths and refs passed to the git-mcp server are validated: file paths may not be absolute or contain traversal sequences (..), and refs may not contain shell-unsafe characters, double-dots, lock suffixes, or leading dashes.
How to use it
- Open the Source Control panel
Click the Source Control icon in the activity bar (or navigate to the Git tab). Oryn automatically runs git status against your open workspace root and populates the panel. - Review your changes
Expand the Staged Changes, Changes, and Untracked sections to see which files have been modified. Each file is labelled with its status letter (M, A, D, R) and colour-coded. Click any file name to open it in the editor. - Stage the files you want to commit
Hover a file in the Changes or Untracked section and click the + button on the right to stage it. To remove a file from staging, hover it in Staged Changes and click โ. Use Discard (โถ) on an unstaged file to revert it, after confirming the dialog. - Write or generate a commit message
Type your message in the text area at the top of the panel. Alternatively, click the AI button (shown as โจ AI) to have the model read your staged diff and draft a Conventional Commits message for you. Review or edit the suggestion before proceeding. - Commit
Click the Commit button or press Ctrl+Enter (Cmd+Enter on macOS). The button is disabled until at least one file is staged and the message field is non-empty. After a successful commit the message field clears and the panel refreshes. - Push or open a pull request via the AI agent
Ask the agent in the chat panel โ for example, 'Push my branch and open a pull request against main' โ and it will use the git-mcp tools to push your branch and scaffold or create the PR if GitHub CLI is available and authenticated. - Refresh manually if needed
Click the Refresh button in the panel header at any time to re-read the working tree state, for example after running git operations in the integrated terminal.
Example
You have edited three files and want to commit. In the Changes section you click + on two of the three files to stage only those. You click AI and within a few seconds the message box fills with: `feat(auth): redirect unauthenticated users to login page`. You adjust the scope to `feat(auth-guard): redirect unauthenticated users to login page`, then press Ctrl+Enter. The commit is created, the staged section clears, and the Recent Commits list now shows your new commit at the top with its short hash and your name.
Admin notes
The AI commit message endpoint (`POST /api/v1/git/commit-message`) requires a valid Oryn license; requests are made through `licensedFetch`, which attaches the licence token automatically. The endpoint calls out to the configured chat model, so the active model must have sufficient quota. The git-mcp MCP server runs as a child process on the user's machine and inherits the process environment, meaning it will pick up `GITHUB_TOKEN` or `GH_TOKEN` environment variables automatically for GitHub CLI authentication. PR creation and review submission default to `dry_run: true`; the agent will only execute live GitHub API calls when the GitHub CLI (`gh`) is installed, authenticated, and the agent explicitly sets `dry_run: false`. Diff truncation limits in the backend are hard-coded at 24 000 characters total and 80 lines per file; very large changesets will always be truncated before being sent to the model.
Related