Git
The playground has git for the project, in the console and in a Git view that takes the file tree’s place. The view runs the same git as the console, so the two always show one repository.
How to open the Git view, and Git in an embed
The status bar’s change counter shows or hides it (Ctrl/Cmd+Shift+G does the same; the choice is kept for the tab); in an embed, a Files | Git switch sits above the tree. The Git view takes the tree’s place, like Source Control in VS Code.
In an embed, Git is the git feature (the ⋯ menu’s Git switch, or -git in features).
The Git view
Section titled “The Git view”-
No repository yet: Initialize repository runs
git init. -
Branch: the button at the top lists the branches, creates one, merges another into the current branch or deletes one.
- The button at the top lists the branches (pick one to switch), creates a branch (Create branch…), merges another one into the current branch (Merge into …) or deletes another one (one whose commits are on no other branch only after a second Delete anyway).
- A switch git can’t make because it would overwrite changed files says so in a box under the branch; the files stay as they were.
-
Merges and conflicts: a merge that stops on conflicts lists the files under Merge Changes; fix them, mark them resolved and commit the merge.
Merge
- A merge (from the branch menu, Pull, or
git mergein the console) that stops on conflicts shows a box with the merge’s name and Abort (merge --abort, asks first), and lists the conflicted files under Merge Changes. - Open a file, fix the lines between
<<<<<<<and>>>>>>>, then Mark as resolved (✓,git add; it asks first while the markers are still there). - Once none are left, Commit merge makes the merge commit, with your message or git’s (
Merge branch 'feat').
Stash and rebase
- A stash that conflicts when applied lists its files the same way.
- A rebase that stops (
git rebase, or Pull withpull.rebaseset) shows its branch and progress the same way. Once the files are resolved, Continue rebase commits that step and replays the rest, Skip this commit leaves it out, and Abort puts the branch back.
- A merge (from the branch menu, Pull, or
-
Stashes: the ⋯ menu's Stash all changes sets every change aside, new files too.
This is
git stash -u. Stashes lists them; hover one to apply it, pop it (apply and drop) or drop it, or click it to read its changes. -
Pull and push: a branch that tracks a remote has ↓ (Pull) and ↑ (Push) next to it; one that tracks none has Publish.
- Each of ↓ and ↑ shows how many commits it would move as of the last fetch.
- A branch that tracks none has Publish instead (
push -utoorigin). - The ⋯ menu also has Fetch.
- A line under the branch says what’s happening while they run, and a push GitHub refuses without an account offers Sign in with GitHub.
-
Commit: type a message and press Commit (or Ctrl/Cmd+Enter in the box).
With nothing staged the button reads Commit all and stages every change first, as VS Code’s smart commit does. The ⋯ menu has Amend last commit and Undo last commit (
reset --soft HEAD~1: its changes stay staged). -
Staged Changes and Changes list each file with its folder and a letter; hover a row to stage, unstage, discard or open it.
Letters
Each file shows its folder and a letter (M modified, A added, D deleted, R renamed, U untracked).
Renames
A staged rename shows as one renamed file, as git pairs them: the same content, or at least half of it; until it is staged, a moved file shows as deleted plus untracked.
Row actions
- Hover a row to stage (+), unstage (−), discard (↺, asks first; an untracked file is deleted) or open the file; the section headers do the same for all files.
- Clicking a row opens the Changes tab at that file’s diff.
-
History: the last 50 commits; click one to read its
git show.
With a repository that has a commit, the file tree marks changed, added, deleted and untracked files, and the Changes tab and the status bar’s counter compare the files with the last commit instead of the project’s source. The view follows your edits, and git commands typed in the console.
Loading cost and when the repository is read
Nothing of git loads (about 1.1 MB) until you open the Git view or run a git command; a project that already has a .git/ reads it at once for the tree’s marks.
How git runs here
Section titled “How git runs here”git runs gitoxide, a Git written in Rust, compiled to WebAssembly, on the project’s files, in a background worker so a command never holds up the editor.
Where the repository lives, and what git ignores
git initmakes a repository in.git/.- git never sees
node_modules/(it isn’t committed in practice, andgit initalso lists it in.git/info/exclude), and it ignores executable bits, which the browser’s files don’t have. - The repository is kept with the project in this browser and survives a reload, but it is not part of share links, downloads or a folder opened from disk, and the file tree doesn’t list
.git/. reset(the console command) throws it away with your other changes.
Supported commands
Section titled “Supported commands”Local commands: init, status, add, commit, log, diff, branch, switch, restore, reset and more
What works:
init,status(-s,-b,--porcelain,-z,-uall; it says whether your branch is ahead of or behind its upstream, as git does),add(paths,.,-A,-u),rm(--cached),commit(-m,-a,--amend,--allow-empty),log(--oneline,--format,-n,--all,-- <path>),diff(and--cached),show(a commit, or<rev>:<path>),branch(list, create,-d/-D,-m).switchandcheckout(-c/-b,--detach, paths; leaving a detached HEAD warns about commits no branch keeps, as git does),restore(--staged,--source),reset(--soft,--mixed,--hard, paths),clean,config(this repository’s.git/config:git config user.name "Ada"signs your commits; otherwise they’re signedPlayground <playground@runbun.dev>) andrev-parse.- Like git,
switchandcheckoutrefuse to overwrite changes you haven’t committed. - Paths are files or folders, not globs.
merge fast-forwards or makes a merge commit, also of several branches at once, and stops on conflicts as git does
merge (--no-ff, --ff-only, -m, --abort, --no-commit, --squash, -s ours, -X ours/-X theirs, -X no-renames, -X diff-algorithm=histogram) fast-forwards or makes a merge commit, also of several branches at once (an octopus merge).
Where both branches changed the same lines it stops with conflict markers in the files, as git does: edit them, git add the files and git commit, or git merge --abort.
tag lists, creates (lightweight or annotated) and deletes tags, with --sort, --contains and --format
tag lists (-l <pattern>, -n, -i, --sort, e.g. --sort=-v:refname, which puts v1.0-rc1 before v1.0 once git config versionsort.suffix -rc is set, --contains, --merged, --points-at and --format, e.g. --format='%(refname:short) %(subject)', with %(align) and %(if)…%(then)…%(else)…%(end)), creates (lightweight, or annotated with -a, -m or -F <file>; not signed) and deletes (-d) tags.
stash sets your changes aside and brings them back, with -u, pop, apply, list and more
stash (-m, -u, -a, -k, --staged, paths after --, list, show, apply, pop, drop, clear, branch, create, store; not --patch, which asks hunk by hunk) sets your changes aside and brings them back; a stash conflicts like a merge does.
rebase replays your branch's commits onto another one, with --onto, --autostash, --continue, --skip and --abort
rebase (--onto, -X ours/-X theirs, --autostash or git config rebase.autoStash true to set your uncommitted changes aside and bring them back after, --continue, --skip, --abort, --quit) replays your branch’s commits onto another one (or another branch’s: git rebase main feat), leaving out those it already has.
- With no upstream named, it rebases onto the branch’s upstream from where your branch forked from it, as git’s
--fork-pointdoes, so commits a force-push removed upstream stay removed. - A conflict stops it with markers in the files, as git does: fix them,
git addandgit rebase --continue(agit commitwithout-min between takes the stopped commit’s message; the Git view shows the rebase with Continue rebase, Skip this commit and Abort). - Not
rebase -i,--execor--rebase-merges.
Remotes on GitHub, GitLab, Codeberg and Bitbucket: remote, fetch, pull, clone and push
With remotes on GitHub, GitLab, Codeberg or Bitbucket (https:// URLs):
remote(-v,add,remove,get-url,set-url),fetch(--depth).pull(fetches and merges, as git’spull.rebase=falsedoes, or fast-forwards;--ff-only,--no-ff;--rebase, orgit config pull.rebase true, rebases your commits onto the fetched ones instead).clone(--depth,-b) into an empty project (or With Git history in the gallery, which makes one).push(-u,-f,-d,<src>:<dst>; refused when the remote has commits you don’t, unless forced), also from the Git view’s pull and push buttons.
Private GitHub repositories and pushing to GitHub work once you sign in with GitHub (the Git view’s ⋯ menu, or Clone a repository, which then lists your repositories; see Privacy) and grant runbun.dev the repository; other hosts are public and read-only.
Git hosts don’t let a browser page talk to them directly, so these requests go through runbun.dev’s git proxy, which passes them on unchanged and keeps nothing (see Privacy).
Was this page helpful?
Sends the rating and this page's address; nothing else unless you write it. Privacy
runbun is an independent project, not affiliated with or endorsed by Oven or Bun.