Git commands
Run Git commands in a selected wabe Disk branch. Every branch has its own editable files and staging. A request never changes a global current branch. Git commands cover filesystem content; user KV is excluded.
Select a branch and commit files
Section titled “Select a branch and commit files”Create a separate git-demo disk with your project API key.
curl --fail-with-body -X PUT "https://api.wabe.sh/v1/disks/git-demo" \ -H "Authorization: Bearer YOUR_PROJECT_API_KEY"HTTP Bash requests containing Git commands require branch=NAME, or an explicit git --branch NAME on each Git command. A missing branch rejects the whole script before execution. For scripts that also edit files, select the branch on the request so every command uses the same view.
curl --fail-with-body --no-buffer \ "https://api.wabe.sh/v1/disks/git-demo/exec?kind=bash&branch=main" \ -H "Authorization: Bearer YOUR_PROJECT_API_KEY" \ --data-binary @- <<'WABE'mkdir -p /notesprintf 'draft\n' > /notes/git-example.txtgit add /notes/git-example.txtgit diff --stagedgit commit -m 'Save the draft'git branch reviewWABEgit add captures the file version at that operation. Later edits remain outside the commit until another git add. git commit -m MESSAGE commits staging and preserves unstaged edits. Commit output includes the native commit UUID, which commands also accept as a commit reference.
The embedded CLI selects the same view with wabe-disk ... exec git-demo --branch review 'git status'. git --branch review status overrides the view for that command only. File redirects outside that command continue to use the request’s branch.
checkout and switch return an error explaining branch selection. The shell runs an explicit set of Git operations; it does not expose arbitrary host Git commands.
Inspect and manage staging
Section titled “Inspect and manage staging”| Command | Behavior |
|---|---|
git status [--short|--porcelain] |
Print short status: the first column compares HEAD with staging; the second compares staging with editable files. ?? means a new unstaged file, and UU marks an unresolved conflict. |
git add PATH... |
Capture literal files or directories recursively, including deletions. git add ., /, -A or --all captures the whole disk. |
git restore --staged PATH... |
Restore selected staged paths to committed HEAD. Editable files remain unchanged. |
git reset [PATH...] |
With paths, unstage them. Without paths, discard staging and recreate it lazily from current HEAD. This also resets staging after a separate HTTP commit advanced HEAD. |
git diff |
Compare staging with editable files. |
git diff --staged [FROM] |
Compare HEAD, or FROM, with staging. |
git diff FROM [TO] |
With one reference, compare it with editable files; with two, compare committed trees. |
git log [--oneline] [-n COUNT] [FROM] |
Show committed history. |
git show [FROM[:PATH]] |
Show a commit, or emit a file’s raw bytes at that commit. |
git branch [NAME [FROM]] |
List branches, or create NAME from FROM, defaulting to HEAD. |
git branch -d NAME |
Delete a clean branch whose tip is an ancestor of the selected branch’s HEAD. The default branch cannot be deleted. |
References are branch names, full native commit UUIDs or full Git SHA-1 IDs available from the current branch histories. Paths are literal paths rooted at /; pathspec globs and interactive staging are unsupported. Diff accepts --stat, --name-only, --name-status and -- PATH.... Status includes empty-directory-independent Git file state; Git trees omit empty directories. Empty staged commits are allowed.
Merge branches
Section titled “Merge branches”Continue the example in review, then merge it into main:
curl --fail-with-body --no-buffer \ "https://api.wabe.sh/v1/disks/git-demo/exec?kind=bash&branch=review" \ -H "Authorization: Bearer YOUR_PROJECT_API_KEY" \ --data-binary @- <<'WABE'printf 'reviewed\n' > /notes/git-example.txtgit add /notes/git-example.txtgit commit -m 'Review the draft'WABE
curl --fail-with-body --no-buffer \ "https://api.wabe.sh/v1/disks/git-demo/exec?kind=bash&branch=main" \ -H "Authorization: Bearer YOUR_PROJECT_API_KEY" \ --data-binary @- <<'WABE'git merge reviewgit log --oneline -n 3WABEMerge requires clean editable files and staging. It fast-forwards when possible; otherwise it uses Git’s three-way merge, including rename and file/directory handling, and creates a commit with both parents. Only the selected branch changes.
Conflicts return status 1, print affected paths and place the proposed result in the selected branch. Text files may contain conflict markers; binary conflicts require choosing or writing the desired bytes. These paths remain unresolved until git add explicitly captures the resolution, even when their bytes match one side.
printf 'resolved content\n' > /notes/git-example.txtgit add /notes/git-example.txtgit merge --continueUse rm PATH followed by git add PATH to resolve a conflict as a deletion. git merge --abort restores the original commit and discards edits made during the operation. Before --continue, stage every remaining edit; this initial implementation rejects unstaged changes at continuation.
Rebase a linear branch
Section titled “Rebase a linear branch”In the branch to rewrite, run git rebase main. It replays that branch’s commits onto main, preserving messages and authors and producing new commit IDs. Empty replayed commits are retained. Histories containing merge commits are rejected before HEAD changes; interactive rebase and --rebase-merges are unsupported.
Resolve each conflict with file edits and git add, then run git rebase --continue. git rebase --abort restores the branch’s original commit, including after earlier commits were replayed. The operation, remaining commits and unresolved paths survive flush, GC and eviction. Ordinary commits, incoming pushes and deletion of the operation’s branch or required commits are rejected until the operation finishes or is aborted.
Each completed rebase step is an atomic publication. An interrupted command can leave a rebase in progress with no unresolved files; git rebase --continue resumes the remaining steps. Branch creation/deletion and Git commits follow the disk’s configured durability policy. Use explicit flush for a remote durability boundary.
Use an ordinary Git remote
Section titled “Use an ordinary Git remote”The Git HTTP endpoint already accepts an ordinary Git client. Configure the remote on your computer:
git remote add wabe "https://api.wabe.sh/v1/disks/git-demo/git"git -c "http.extraHeader=Authorization: Bearer YOUR_PROJECT_API_KEY" \ fetch wabeSee self-hosting for publishing a standalone server over HTTPS.
After rewriting local history, use git push --force-with-lease wabe BRANCH. The server checks the client’s old Git ID and compares its native branch record again before publishing. A stale lease or concurrent branch edit rejects the push. Git protocol does not distinguish --force from --force-with-lease; the client supplies the lease protection.
Runtime requirements and limits
Section titled “Runtime requirements and limits”Inspection, merge and rebase require the server’s Git executable. Merge/rebase require merge-tree --write-tree support (Git 2.38 or later). They reuse the experimental disposable bare-repository adapter. CPU, RAM and local scratch costs grow with retained history; no checkout is created. Diff output is spooled to a temporary file and streamed. Performance of the new operations has not been benchmarked.
The shell has no outbound git push, fetch, pull, clone or remote configuration command. Use an ordinary Git client for network operations. Tags, submodules, ref deletion through push, custom merge strategies, commit signing and hooks are unsupported. Git publication currently does not emit file notifications. See transport constraints.