# Docs

> How to use grit, a simple Git client built on grit-lib. Start with the tutorial, then look up any command or open the library guide.

Grit is two things:

- **`grit`** — a Git client with a small, modern command line. It works on any Git repository and talks to any Git remote, but its commands are its own: one obvious way to do the common thing, plain-language output, and `--json` on every command.
- **`grit-lib`** — a fast, linkable Git library for Rust. Everything the CLI does goes through the library; you can embed the same engine in your own tools.

## How these docs are organized

| Section | What you'll find |
| --- | --- |
| **Getting started** | [Install](https://grit-scm.com/docs/install/index.md) grit, follow the [tutorial](https://grit-scm.com/docs/tutorial/index.md), or try the [library quick start](https://grit-scm.com/docs/library-quickstart/index.md). |
| **The grit CLI** | [Global options](https://grit-scm.com/docs/global-options/index.md), [scripting with `--json`](https://grit-scm.com/docs/scripting/index.md), [agent guide](https://grit-scm.com/docs/agents/index.md), and a man page for every command. |
| **Library guide** | Rust-oriented guides for `grit-lib` (growing over time), plus the [API reference on docs.rs](https://docs.rs/grit-lib). |
| **Benchmarks** | How `grit` and `grit-lib` compare to system Git on core operations. |

If you're new to the command line, start with the [tutorial](https://grit-scm.com/docs/tutorial/index.md). If you're wiring Git into a Rust program, start with the [library quick start](https://grit-scm.com/docs/library-quickstart/index.md) and the [library guide overview](https://grit-scm.com/docs/library/index.md).

## CLI vs library

Use **`grit`** when you want a day-to-day Git client from the terminal or in scripts (`--json` / `--filter`). Use **`grit-lib`** when you need programmatic access — opening repositories, reading objects and refs, diffing, revwalking, fetch/push, and the rest of Git's core — inside a Rust binary or service.

On-disk formats and the wire protocol stay compatible with Git; the CLI's argv and messages are deliberately *not* a Git mirror.

See [Install](https://grit-scm.com/docs/install/index.md) for download options, [Global options](https://grit-scm.com/docs/global-options/index.md) for flags shared by every command, [Scripting with grit](https://grit-scm.com/docs/scripting/index.md) for `--json` and `--filter`, and the [Agent guide](https://grit-scm.com/docs/agents/index.md) for automation-focused details.

## For agents

- [grit-cli.md](https://grit-scm.com/docs/grit-cli.md): the whole CLI in one file, to learn grit for everyday Git work.
- [grit-lib.md](https://grit-scm.com/docs/grit-lib.md): the whole library guide in one file, to build Git-compatible Rust programs.
- [llms.txt](https://grit-scm.com/llms.txt): an index of every page with a one-line summary.
- [llms-full.txt](https://grit-scm.com/llms-full.txt): every docs page in one file.

Every page also has a Markdown twin: replace `index.html` with `index.md` in its URL. Run `grit skill` to print an agent skill for the CLI.

## Commands

### Getting started

| Command | Summary |
| --- | --- |
| [`grit init`](https://grit-scm.com/docs/init/index.md) | Create a new, empty repository. |
| [`grit clone`](https://grit-scm.com/docs/clone/index.md) | Copy a remote repository into a new directory. |
| [`grit checkout`](https://grit-scm.com/docs/checkout/index.md) | Start work on a repository from a snapshot of its main branch, or of some of its paths, instead of a clone. |
| [`grit status`](https://grit-scm.com/docs/status/index.md) | Show where you are and what's changed. This is what plain grit runs. |
| [`grit config`](https://grit-scm.com/docs/config/index.md) | Read, set, list or remove configuration values. |

### Making changes

| Command | Summary |
| --- | --- |
| [`grit add`](https://grit-scm.com/docs/add/index.md) | Stage changes. With no paths, stages everything. |
| [`grit commit`](https://grit-scm.com/docs/commit/index.md) | Stage every change and record a new commit. |
| [`grit diff`](https://grit-scm.com/docs/diff/index.md) | Show uncommitted, staged, commit, or range changes. |
| [`grit restore`](https://grit-scm.com/docs/restore/index.md) | Restore working tree and/or index paths from HEAD, the index, or another revision. |
| [`grit rm`](https://grit-scm.com/docs/rm/index.md) | Remove tracked paths from the working tree and index. |
| [`grit mv`](https://grit-scm.com/docs/mv/index.md) | Rename or move tracked paths. |
| [`grit stash`](https://grit-scm.com/docs/stash/index.md) | Save and restore shelved work. |

### History

| Command | Summary |
| --- | --- |
| [`grit log`](https://grit-scm.com/docs/log/index.md) | Show commits, newest first: the whole history in the pager on a terminal, a page at a time for scripts and agents. |
| [`grit blame`](https://grit-scm.com/docs/blame/index.md) | Show who last modified each line of a file. |
| [`grit reflog`](https://grit-scm.com/docs/reflog/index.md) | Show, delete, or expire reflog entries. |
| [`grit shortlog`](https://grit-scm.com/docs/shortlog/index.md) | List the commits on this branch that aren't on the target branch yet. |
| [`grit revs`](https://grit-scm.com/docs/revs/index.md) | List or count commits matching revision ranges. |
| [`grit show`](https://grit-scm.com/docs/show/index.md) | Show a commit, tag or branch, and the change it introduced. |
| [`grit merge-base`](https://grit-scm.com/docs/merge-base/index.md) | Find common ancestors or test whether one commit is an ancestor of another. |
| [`grit notes`](https://grit-scm.com/docs/notes/index.md) | List, show, add, and remove Git notes on commits. |
| [`grit describe`](https://grit-scm.com/docs/describe/index.md) | Nearest reachable tag, exact commit distance, and abbreviated id for a revision. |
| [`grit rebase`](https://grit-scm.com/docs/rebase/index.md) | Replay local commits onto a new base; recover from conflicts and exec commands that leave edits. |
| [`grit history`](https://grit-scm.com/docs/history/index.md) | Stateless history rewrite helpers (reword, and more over time). |

### Branches and tags

| Command | Summary |
| --- | --- |
| [`grit branch`](https://grit-scm.com/docs/branch/index.md) | List branches, or create, delete, rename, or configure one. |
| [`grit switch`](https://grit-scm.com/docs/switch/index.md) | Switch to another branch, remote branch, or detached commit. |
| [`grit merge`](https://grit-scm.com/docs/merge/index.md) | Merge another branch, tag or commit into the current one. |
| [`grit reset`](https://grit-scm.com/docs/reset/index.md) | Move the branch tip and optionally reset the index or worktree. |
| [`grit pick`](https://grit-scm.com/docs/pick/index.md) | Cherry-pick one or more commits onto the current branch. |
| [`grit revert`](https://grit-scm.com/docs/revert/index.md) | Undo commits with new inverse commits. |
| [`grit tag`](https://grit-scm.com/docs/tag/index.md) | List tags, or create or delete one (lightweight or annotated). |
| [`grit worktree`](https://grit-scm.com/docs/worktree/index.md) | List, add, and remove linked worktrees for the same repository. |

### Remotes

| Command | Summary |
| --- | --- |
| [`grit remote`](https://grit-scm.com/docs/remote/index.md) | List remotes, add one, show one, set URLs, rename or remove one, or list refs on a remote. |
| [`grit fetch`](https://grit-scm.com/docs/fetch/index.md) | Download new commits, branches and tags from a remote. |
| [`grit pull`](https://grit-scm.com/docs/pull/index.md) | Fetch from the remote and bring the current branch up to date. |
| [`grit push`](https://grit-scm.com/docs/push/index.md) | Publish branches, tags, or explicit refspecs to a remote. |
| [`grit auth`](https://grit-scm.com/docs/auth/index.md) | Sign in to GitButler Code, GitHub or a grit serve host, or save a username and token for any HTTPS host, so pushes and fetches just work. |
| [`grit bundle`](https://grit-scm.com/docs/bundle/index.md) | Create, verify, list, and unbundle git bundle files for offline transfer. |
| [`grit serve`](https://grit-scm.com/docs/serve/index.md) | Serve repositories over HTTP, with a web view where people sign in with email and password. |
| [`grit checkin`](https://grit-scm.com/docs/checkin/index.md) | Send a snapshot checkout's branches back to the server, rebuilt on its real history. |
| [`grit integrate`](https://grit-scm.com/docs/integrate/index.md) | Merge a branch into the server's target branch, from a snapshot checkout or a clone of a hosted project. |
| [`grit slice`](https://grit-scm.com/docs/slice/index.md) | Name sets of paths to check out together, kept on the server's target branch. |
| [`grit sync`](https://grit-scm.com/docs/sync/index.md) | Push and pull every active branch between a clone and your space on a grit hosting server. |
| [`grit share`](https://grit-scm.com/docs/share/index.md) | Work on a branch together with other users of a grit hosting server, each with their own head of it. |

### Maintenance

| Command | Summary |
| --- | --- |
| [`grit clean`](https://grit-scm.com/docs/clean/index.md) | Remove untracked files from the working tree. |
| [`grit update`](https://grit-scm.com/docs/update/index.md) | Update grit to the latest release. |
| [`grit repack`](https://grit-scm.com/docs/repack/index.md) | Pack reachable objects and remove redundant packs. |
| [`grit skill`](https://grit-scm.com/docs/skill/index.md) | Print an agent skill that explains how to use grit. |
| [`grit completions`](https://grit-scm.com/docs/completions/index.md) | Generate shell completion scripts for bash, zsh, and fish. |
| [`grit gc`](https://grit-scm.com/docs/gc/index.md) | Run repository maintenance — pack refs, expire reflogs, repack, prune, and refresh commit-graph. |
| [`grit fsck`](https://grit-scm.com/docs/fsck/index.md) | Check refs, objects, and pack indexes for problems. |

### Plumbing

| Command | Summary |
| --- | --- |
| [`grit hooks`](https://grit-scm.com/docs/hooks/index.md) | List hook scripts and run them by name. |
| [`grit upload-pack`](https://grit-scm.com/docs/upload-pack/index.md) | Serve a fetch or clone of a repository over stdin and stdout. |
| [`grit patch-id`](https://grit-scm.com/docs/patch-id/index.md) | Stable patch-IDs for commits (cherry-pick equivalence). |
| [`grit receive-pack`](https://grit-scm.com/docs/receive-pack/index.md) | Accept a push to a repository over stdin and stdout. |
| [`grit manager`](https://grit-scm.com/docs/manager/index.md) | A credential helper that stores passwords and tokens in the Windows Credential Manager. |
| [`grit resolve`](https://grit-scm.com/docs/resolve/index.md) | Resolve revision specs to object ids and types. |
| [`grit cat`](https://grit-scm.com/docs/cat/index.md) | Show blob, tree, commit, or tag contents for a revision spec. |
| [`grit ignore`](https://grit-scm.com/docs/ignore/index.md) | Query whether paths match exclude (gitignore) rules. |
