GitDB terminal
Run git-style commands against your GitDB repository from a built-in VS Code terminal.
The GitDB terminal is a built-in VS Code terminal for git-style commands. Every command runs on GitDB against the repository you're connected to, and nothing is cloned to your computer.
Open the terminal
Run GitDB: Open Terminal from the Command Palette, or click the terminal icon in the Files view's title bar. A terminal named GitDB opens with this greeting:
GitDB terminal — server-side git commands (no local clone).
Type 'help' for commands (the leading 'git' is optional). clone/push/pull are not applicable here.The prompt shows the repository and current branch, like organization/name:main$. The terminal always works on the repository you're connected to right now. If you switch repositories, an open terminal follows the switch. If you're not connected, commands reply Not connected. Connect to a GitDB repo (or switch to one) first.
Commands
Type help (or ?) to see the command list:
GitDB commands (server-side, no local files) — a leading "git" is optional:
status staged changes on the current branch
log [n] recent commits (default 20)
show <ref> a commit: metadata + tree
diff <from> <to> changed files between two refs
ls [path] list a directory at the current branch
cat <path> print a file (first 500 lines)
grep <pattern> search file contents
branches list branches
tags list tags
branch <name> create a branch from the current branch
tag <name> create a tag at the current branch
commit -m "message" commit the staged changes
merge <branch> merge <branch> into the current branch
clear clear the screen
help this help
Not applicable (GitDB keeps code server-side): clone, push, pull, fetch.A leading git is optional, so git log 5 and log 5 do the same thing. To pass an argument that contains spaces, such as a commit message, wrap it in double quotes.
How the commands behave
statuslists only staged changes on the current branch. Changes you haven't staged don't appear.log [n]shows the most recent commits on the current branch, 20 by default. Each line shows the short ID, the date, the author, and the first line of the message.show <ref>prints a commit's ID, author, date, parent, message, and file tree.diff <from> <to>lists the files that changed between two refs and what kind of change each one had. It doesn't print line-by-line differences.ls [path]lists a directory on the current branch. Folder names end with/.cat <path>prints the first 500 lines of a file on the current branch.grep <pattern>searches file contents on the current branch and printspath:line: textfor each match. Long results end with… (truncated).branchesandtagslist branches or tags, each with its short commit ID.branch <name>creates a branch from the current branch. You stay on the current branch.tag <name>creates a tag at the current branch's latest commit.commit -m "message"commits only your staged changes. This is different from the Source Control commit, which commits everything when nothing is staged. If nothing is staged, the terminal tells you to stage your changes first. Stage them in the Source Control view (see Edit and commit).merge <branch>merges<branch>into the current branch and prints the result:success,fast_forward,already_up_to_date, orconflicts. If it reportsconflicts, nothing was merged. See Merging.clearclears the screen.
After you commit, branch, tag, or merge from the terminal, run GitDB: Refresh to update the GitDB views and Source Control.
Commands that don't apply
GitDB keeps your code on GitDB, not on your computer, so clone, push, pull, and fetch have nothing to do here. If you type one, the terminal replies:
'push' is not applicable — GitDB keeps all code server-side (no local clone). Use commit / branch / tag / merge, which run against the server.Any other unknown command gets gitdb: '<command>' is not a command. Type 'help'.
Keys
- Up and Down move through the commands you've already run.
- Ctrl+C clears the line you're typing.
- Backspace deletes the last character.