|  | 
|  | 1 | +Getting Started | 
|  | 2 | +=============== | 
|  | 3 | + | 
|  | 4 | +Registering existing Git repos | 
|  | 5 | +------------------------------ | 
|  | 6 | + | 
|  | 7 | +To add a repository to the list of registered repos, run `scalar register [<path>]`. | 
|  | 8 | +If `<path>` is not provided, then the "current repository" is discovered from | 
|  | 9 | +the working directory by scanning the parent paths for a path containing a `.git` | 
|  | 10 | +folder, possibly inside a `src` folder. | 
|  | 11 | + | 
|  | 12 | +To see which repositories are currently tracked by the service, run | 
|  | 13 | +`scalar list`. | 
|  | 14 | + | 
|  | 15 | +Run `scalar unregister [<path>]` to remove the repo from this list. | 
|  | 16 | + | 
|  | 17 | +Creating a new Scalar clone | 
|  | 18 | +--------------------------------------------------- | 
|  | 19 | + | 
|  | 20 | +The `clone` verb creates a local enlistment of a remote repository using the | 
|  | 21 | +partial clone feature available e.g. on GitHub. | 
|  | 22 | + | 
|  | 23 | + | 
|  | 24 | +``` | 
|  | 25 | +scalar clone [options] <url> [<dir>] | 
|  | 26 | +``` | 
|  | 27 | + | 
|  | 28 | +Create a local copy of the repository at `<url>`. If specified, create the `<dir>` | 
|  | 29 | +directory and place the repository there. Otherwise, the last section of the `<url>` | 
|  | 30 | +will be used for `<dir>`. | 
|  | 31 | + | 
|  | 32 | +At the end, the repo is located at `<dir>/src`. By default, the sparse-checkout | 
|  | 33 | +feature is enabled and the only files present are those in the root of your | 
|  | 34 | +Git repository. Use `git sparse-checkout set` to expand the set of directories | 
|  | 35 | +you want to see, or `git sparse-checkout disable` to expand to all files. You | 
|  | 36 | +can explore the subdirectories outside your sparse-checkout specification using | 
|  | 37 | +`git ls-tree HEAD`. | 
|  | 38 | + | 
|  | 39 | +### Sparse Repo Mode | 
|  | 40 | + | 
|  | 41 | +By default, Scalar reduces your working directory to only the files at the | 
|  | 42 | +root of the repository. You need to add the folders you care about to build up | 
|  | 43 | +to your working set. | 
|  | 44 | + | 
|  | 45 | +* `scalar clone <url>` | 
|  | 46 | +  * Please choose the **Clone with HTTPS** option in the `Clone Repository` dialog in Azure Repos, not **Clone with SSH**. | 
|  | 47 | +* `cd <root>\src` | 
|  | 48 | +* At this point, your `src` directory only contains files that appear in your root | 
|  | 49 | +  tree. No folders are populated. | 
|  | 50 | +* Set the directory list for your sparse-checkout using: | 
|  | 51 | +	1. `git sparse-checkout set <dir1> <dir2> ...` | 
|  | 52 | +	2. `git sparse-checkout set --stdin < dir-list.txt` | 
|  | 53 | +* Run git commands as you normally would. | 
|  | 54 | +* To fully populate your working directory, run `git sparse-checkout disable`. | 
|  | 55 | + | 
|  | 56 | +If instead you want to start with all files on-disk, you can clone with the | 
|  | 57 | +`--full-clone` option. To enable sparse-checkout after the fact, run | 
|  | 58 | +`git sparse-checkout init --cone`. This will initialize your sparse-checkout | 
|  | 59 | +patterns to only match the files at root. | 
|  | 60 | + | 
|  | 61 | +If you are unfamiliar with what directories are available in the repository, | 
|  | 62 | +then you can run `git ls-tree -d --name-only HEAD` to discover the directories | 
|  | 63 | +at root, or `git ls-tree -d --name-only HEAD <path>` to discover the directories | 
|  | 64 | +in `<path>`. | 
|  | 65 | + | 
|  | 66 | +### Options | 
|  | 67 | + | 
|  | 68 | +These options allow a user to customize their initial enlistment. | 
|  | 69 | + | 
|  | 70 | +* `--full-clone`: If specified, do not initialize the sparse-checkout feature. | 
|  | 71 | +  All files will be present in your `src` directory. This uses a Git partial | 
|  | 72 | +  clone: blobs are downloaded on demand. | 
|  | 73 | + | 
|  | 74 | +* `--branch=<ref>`: Specify the branch to checkout after clone. | 
|  | 75 | + | 
|  | 76 | +### Advanced Options | 
|  | 77 | + | 
|  | 78 | +The options below are not intended for use by a typical user. These are | 
|  | 79 | +usually used by build machines to create a temporary enlistment that | 
|  | 80 | +operates on a single commit. | 
|  | 81 | + | 
|  | 82 | +* `--single-branch`: Use this option to only download metadata for the branch | 
|  | 83 | +  that will be checked out. This is helpful for build machines that target | 
|  | 84 | +  a remote with many branches. Any `git fetch` commands after the clone will | 
|  | 85 | +  still ask for all branches. | 
|  | 86 | + | 
|  | 87 | +Removing a Scalar Clone | 
|  | 88 | +----------------------- | 
|  | 89 | + | 
|  | 90 | +Since the `scalar clone` command sets up a file-system watcher (when available), | 
|  | 91 | +that watcher could prevent deleting the enlistment. Run `scalar delete <path>` | 
|  | 92 | +from outside of your enlistment to unregister the enlistment from the filesystem | 
|  | 93 | +watcher and delete the enlistment at `<path>`. | 
0 commit comments