# Configuring Sparse-Checkout for Clone Without Translations in AI-For-Beginners

> Learn to configure Git sparse-checkout for the AI-For-Beginners repository. Clone only English curriculum and core resources, excluding translations, to reduce repository size significantly.

- Repository: [Microsoft/AI-For-Beginners](https://github.com/microsoft/AI-For-Beginners)
- Tags: how-to-guide
- Published: 2026-08-26

---

**Use Git’s sparse-checkout feature to clone only the English curriculum and core resources, excluding the 40+ language translations housed in `translations/` and `translated_images/`, thereby reducing the repository size by approximately 50–70%.**

Configuring sparse-checkout for clone without translations is essential when you want the Microsoft **AI-For-Beginners** curriculum—complete with Jupyter notebooks, Python examples, and Vue.js quiz applications—without downloading the multilingual documentation and localized image assets. The repository’s `translations/` directory replicates the entire 24-lesson structure for dozens of locales, significantly increasing clone time and disk usage for learners who only need the English content.

## Repository Structure and Translation Footprint

The AI-For-Beginners project organizes its 12-week curriculum across several high-level directories. According to the source layout documented in [`translations/README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/translations/README.md), the localization layer duplicates every lesson and visual asset:

- **`lessons/`** – Contains the 24 core lessons on Symbolic AI, Neural Networks, Computer Vision, and NLP.
- **`examples/`** – Standalone Python scripts for quick concept demonstrations.
- **`etc/`** – Houses the Vue.js quiz application (`etc/quiz-app/`) and tooling configuration.
- **`translations/`** – One subdirectory per locale (e.g., `translations/zh-TW/`, `translations/fr/`) mirroring the full lesson tree.
- **`translated_images/`** – Localized screenshots and diagrams for each supported language.

Because each translation includes both markdown files and duplicated image assets under `translated_images/`, a full clone can exceed several hundred megabytes. Sparse-checkout allows you to fetch only the working directories required for the English curriculum.

## Initializing a Partial Clone with Blob Filtering

Begin by creating a **partial clone** that omits unneeded blob objects. This command downloads commit history and tree structures but defers file content until checkout:

```bash
git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners

```

The `--filter=blob:none` flag ensures that translation files are not downloaded during the initial clone phase, while `--sparse` prepares the working directory for sparse-checkout patterns.

## Configuring Sparse-Checkout Cone Mode

Modern Git (version 2.37 and later) supports **negative patterns** in cone mode, allowing you to include all files by default while explicitly excluding the translation directories. This is the most maintainable approach for AI-For-Beginners, as it automatically includes new lessons or root-level files without updating your sparse-checkout list.

Run the following sequence to exclude `translations/` and `translated_images/`:

```bash

# Enable cone mode with sparse index for performance

git sparse-checkout set --cone --sparse-index

# Include everything at the root level

git sparse-checkout set /*

# Exclude translation directories

git sparse-checkout add !translations/
git sparse-checkout add !translated_images/

```

If you are using an older Git version that does not support the `!` exclusion syntax, explicitly enumerate the directories you need:

```bash
git sparse-checkout set --cone \
  lessons/ \
  examples/ \
  etc/ \
  .devcontainer/ \
  binder/ \
  README.md \
  AGENTS.md \
  environment.yml \
  requirements.txt \
  LICENSE \
  CONTRIBUTING.md \
  SECURITY.md

```

This pattern ensures that `lessons/4-ComputerVision/07-ConvNets/` and other lesson paths are fully populated, while `translations/zh-TW/` and `translated_images/de/` remain absent from your working tree.

## Verifying the Filtered Clone

After configuring sparse-checkout, confirm that the translation layers are absent and only the English curriculum remains:

```bash

# List top-level directories; translations/ should not appear

ls -d */

# Check disk usage of the partial clone

du -sh .

# Verify specific lesson files are present

ls lessons/4-ComputerVision/07-ConvNets/

```

The working directory should now contain only the files necessary to run the curriculum locally using the Conda environment defined in [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) or the pip requirements in [`requirements.txt`](https://github.com/microsoft/AI-For-Beginners/blob/main/requirements.txt).

## Restoring Translations Later

If you later require a specific translation—for example, to review the Chinese (Traditional) version of the Computer Vision module—you can fetch it on demand without re-cloning:

```bash
git sparse-checkout add translations/zh-TW/
git sparse-checkout add translated_images/zh-TW/
git checkout HEAD -- translations/zh-TW/ translated_images/zh-TW/

```

This command updates your sparse-checkout pattern to include the requested locale and populates the working directory with the previously excluded files.

## Summary

- **Configuring sparse-checkout for clone without translations** eliminates the `translations/` and `translated_images/` directories, reducing download size and setup time for the AI-For-Beginners curriculum.
- Use `git clone --filter=blob:none --sparse` to initialize a partial clone that defers downloading translation assets.
- In Git 2.37+, employ cone mode with negative patterns (`!translations/`) to automatically exclude localized content while retaining root files and core lesson directories.
- The `lessons/`, `examples/`, `etc/`, `.devcontainer/`, and `binder/` directories contain all executable content needed for the English-language course.
- Translations can be re-added selectively using `git sparse-checkout add` if multilingual support becomes necessary later.

## Frequently Asked Questions

### Does sparse-checkout persist when pulling future updates?

Yes. Once configured, sparse-checkout patterns remain active for subsequent `git pull` or `git fetch` operations. New files added to `translations/` in future commits will not appear in your working directory unless you update the sparse-checkout inclusion list.

### How much disk space does excluding translations save?

While the core English curriculum and code in `lessons/` and `examples/` comprise roughly 30–50 MB, the `translations/` directory and its corresponding assets in `translated_images/` add significant overhead due to 40+ language duplications. Excluding these typically reduces the repository footprint by 50–70%, depending on the density of visual assets in the localized versions.

### Can I use sparse-checkout with GitHub Codespaces or VS Code Dev Containers?

Yes. The [`.devcontainer/devcontainer.json`](https://github.com/microsoft/AI-For-Beginners/blob/main/.devcontainer/devcontainer.json) configuration in the repository assumes a full clone, but you can configure sparse-checkout inside the container after initialization. Because the devcontainer Dockerfile installs dependencies based on [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)—which resides in the root and is included in your sparse pattern—the development environment will build correctly without the translation files.

### What Git version supports excluding directories with negative patterns?

Git version **2.37.0** introduced support for negative patterns (e.g., `!translations/`) in sparse-checkout cone mode. Earlier versions require you to explicitly list every directory you want to include rather than specifying exclusions.