Git Reference ยท Maintenance and Recovery
scalar command
Reference for the scalar command: clone, register, list, run, reconfigure, diagnose and delete, and the Git settings it turns on for big monorepos.
scalar is a companion program that ships with Git. It does not add new storage tricks; it switches on the ones Git already has and keeps them running. When you clone or register a repository, Scalar enables a partial clone (no file contents until needed), sparse checkout, the file system monitor, the commit-graph with Bloom filters, the untracked cache and background maintenance. The result is a fast git status, git fetch and git log in repositories with millions of files and commits.
You still use ordinary git commands inside a Scalar repository. Scalar only sets it up (clone, register, reconfigure), repairs it (run), collects information (diagnose) and tidies up (unregister, delete).
scalar clone https://example.com/big/monorepo.git scalar register
Try it
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Press Run (or Ctrl + Enter) to see the result here.
Program input ยท what you'd type while the program runs
Type the answers before you press Run, one per line. Each time the program reads a line (with read or cat), it gets the next line from this box.
Syntax
scalar [-C <directory>] [-c <key>=<value>] <command> [<options>] scalar clone [--single-branch] [--branch <name>] [--full-clone] [--[no-]src] [--[no-]tags] [--[no-]maintenance] <url> [<enlistment>] scalar register [--[no-]maintenance] [<enlistment>] scalar unregister [<enlistment>] scalar list scalar run ( all | config | commit-graph | fetch | loose-objects | pack-files ) [<enlistment>] scalar reconfigure [ --all | <enlistment> ] [--maintenance=<mode>] scalar diagnose [<enlistment>] scalar delete <enlistment> scalar version [--verbose] [--build-options]
| Command or option | Description |
|---|---|
clone <url> [<enlistment>] |
Clone with --filter=blob:none, sparse checkout and the tuned configuration. The repository lands in <enlistment>/src. |
--full-clone |
Fetch all file contents and check out everything, like an ordinary clone, but keep the other settings. |
--single-branch |
Fetch only the history of the default (or --branch) branch. |
--no-src |
Put the repository directly in <enlistment> instead of <enlistment>/src. |
--no-tags |
Do not fetch tags. |
register |
Apply the settings to an existing repository and add it to the list of Scalar repositories (scalar.repo). |
--no-maintenance |
Do not register the repository for background maintenance. |
unregister |
Stop tracking the repository; it keeps its files and settings. |
list |
Print the registered repositories, one per line. |
run <task> |
Run one maintenance task now, or all. config re-applies the settings; fetch is the prefetch of refs/prefetch/; commit-graph, loose-objects and pack-files match the tasks of git maintenance. |
reconfigure |
Re-apply the current recommended settings, for one repository or --all registered ones. Use it after upgrading Git. |
diagnose |
Write a zip file of logs, configuration and statistics (no file contents) to .scalarDiagnostics/ for support. |
delete <enlistment> |
Unregister and delete the whole enlistment directory. |
Returns: exit status 0 on success; a non-zero status with a fatal: message otherwise, for example fatal: '<dir>/<enlistment>' does not exist.
Usage notes
- What it configures. Among others:
core.untrackedCache,core.fsmonitor,fetch.unpackLimit=1,fetch.showForcedUpdates=false,gc.auto=0(maintenance does the work instead),index.version=4,index.skipHash,merge.renames,pack.useBitmaps=false,commitGraph.changedPaths,status.aheadBehind=false, plus the credential setting for Azure DevOps. Treat the list as version-dependent and check withgit config --list --local. - Background maintenance. With maintenance enabled,
scalarrunsgit maintenance start, which installs a scheduled job (cron, systemd timer, launchd or Task Scheduler). Hourly prefetch keepsgit fetchfast; daily and weekly tasks handle the object database. - Partial clone consequences. Files outside the sparse checkout are not downloaded; Git fetches missing blobs on demand, so working offline can fail. See git sparse-checkout and git clone.
status.aheadBehind=falsehides ahead/behind counts ingit status, because computing them is slow on huge histories. Usegit status --ahead-behindfor one-off checks.- File system monitor.
core.fsmonitor=truestarts a background daemon per repository. See git fsmonitor--daemon. - Not a different Git. After setup everything is plain Git; removing the Scalar settings by hand returns the repository to normal behavior.
- Availability. Scalar is built and shipped by default with Git for Windows and Homebrew; Linux packages may need
make -C contrib/scalar installor an extra package.