# How to Use Sparse Git Checkout to Clone AI-For-Beginners Without Translations

> Clone Microsoft AI For Beginners without translations using sparse Git checkout. Save disk space by excluding large language folders. Learn the technique.

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

---

**Use `git clone --filter=blob:none --sparse` followed by `git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'` to download only the core Microsoft AI curriculum while excluding the 50+ language translation folders that bloat the repository size.**

The **microsoft/AI-For-Beginners** repository contains a comprehensive artificial intelligence curriculum with Jupyter notebooks, Python scripts, and a Vue.js quiz application. However, it also ships with extensive translation assets across more than 50 languages stored in `translations/` and `translated_images/` directories. Using sparse git checkout allows you to fetch only the essential learning materials while skipping the bandwidth-heavy translation payload, as officially documented in the repository's [`README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/README.md) at lines 31-40.

## Why Exclude Translations from the Clone?

The **AI-For-Beginners** repository includes localized content for dozens of languages, dramatically increasing the repository size and clone time. These assets reside primarily in two locations:

- `translations/` – Contains markdown files and notebooks translated into various languages
- `translated_images/` – Houses localized screenshots and diagrams

For developers who only need the English curriculum or want to minimize disk usage and network bandwidth, downloading these folders is unnecessary. The core curriculum—including all lessons, labs, and the quiz application—functions independently of these translation trees.

## The Sparse Git Checkout Solution

Git's **sparse checkout** feature enables partial working directories, allowing you to specify exactly which paths to populate while leaving others untracked. When combined with **blob filters**, this approach downloads only the commit history initially, fetching file contents on demand.

The repository's [`README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/README.md) explicitly recommends this method for users who prefer a lightweight local clone. The technique relies on three key Git mechanisms:

1. `--filter=blob:none` – Downloads commit history without file contents, deferring blob downloads until files are actually accessed
2. `--sparse` – Initializes the repository in sparse-checkout mode
3. `--no-cone` – Enables pattern matching mode that allows exclusion patterns (negations) using the `!` prefix

## Step-by-Step Implementation

### Clone the Repository (Bash/macOS/Linux)

Run these commands in your terminal to create a minimal working copy:

```bash

# Clone without downloading file blobs

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

# Configure sparse checkout to exclude translation directories

git sparse-checkout set --no-cone '/*' '!translations' '!translated_images'

```

### Clone the Repository (Windows CMD)

For Windows Command Prompt users, use double quotes for pattern arguments:

```cmd
git clone --filter=blob:none --sparse https://github.com/microsoft/AI-For-Beginners.git
cd AI-For-Beginners
git sparse-checkout set --no-cone "/*" "!translations" "!translated_images"

```

### Verify the Sparse Checkout

Confirm that translation folders are excluded by listing top-level directories:

```bash
ls -d */ | grep -v translations

```

You should see `lessons/`, `etc/`, and other core directories, but no `translations/` or `translated_images/` folders. The working copy now contains approximately the minimal set of files needed to run the curriculum.

## Understanding the Sparse Checkout Patterns

The command `git sparse-checkout set --no-cone` writes patterns to `.git/info/sparse-checkout`, a generated file that controls which paths Git populates in your working directory.

The pattern syntax used here includes:

- `/*` – Include all files and folders at the repository root
- `!translations` – Exclude the translations directory and all its contents
- `!translated_images` – Exclude the translated images directory

The `--no-cone` flag is critical because it enables the exclusion syntax (`!`). Without this flag, Git uses "cone mode," which only supports recursive directory patterns and does not allow negations.

## Managing Excluded Content Later

If you later decide you need a specific language translation, you can selectively add it back without recloning the entire repository:

```bash
git sparse-checkout add translations/zh-CN

```

This command updates your sparse-checkout patterns to include the specified path while maintaining exclusions for other translation folders. Git will then fetch the necessary blobs for that specific translation on demand.

## What You Get After Sparse Checkout

After completing the sparse checkout, your local copy contains all essential curriculum components:

- **`lessons/`** – The core Jupyter notebooks, Python scripts, and lab exercises
- **`etc/quiz-app/`** – The standalone Vue.js quiz application
- **[`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml)** – Conda environment specification with Python dependencies
- **[`README.md`](https://github.com/microsoft/AI-For-Beginners/blob/main/README.md)** – Documentation and course overview

The working copy excludes only the translation assets, leaving you with a development-ready environment suitable for local execution, GitHub Codespaces, or CI/CD pipelines.

## Summary

- **Sparse git checkout** with `--filter=blob:none` and `--sparse` creates a lightweight clone by deferring file downloads and excluding specific directories.
- **Pattern syntax** using `--no-cone` with `/*` and `!translations` includes the core curriculum while excluding 50+ language translation folders.
- **Verification** confirms the absence of `translations/` and `translated_images/` directories while preserving `lessons/` and `etc/quiz-app/`.
- **Selective addition** via `git sparse-checkout add` allows retrieving specific translations later without full reclone.

## Frequently Asked Questions

### What is sparse git checkout and how does it reduce clone size?

Sparse git checkout is a Git feature that allows you to populate only specific directories of a repository's working tree while leaving others untracked. When combined with `--filter=blob:none`, Git downloads only the commit history initially, fetching actual file contents (blobs) only when accessed or when directories are explicitly included via sparse-checkout patterns.

### Why does the AI-For-Beginners repository need sparse checkout?

The repository contains translation assets for over 50 languages in `translations/` and `translated_images/` directories, which significantly increase repository size and clone time. Sparse checkout allows learners to download only the English curriculum and core code, reducing bandwidth usage and disk space requirements while maintaining full functionality of the Jupyter notebooks and quiz application.

### Can I access translations later if I clone without them?

Yes, you can selectively add specific translations later using `git sparse-checkout add translations/[language-code]`, such as `git sparse-checkout add translations/zh-CN` for Simplified Chinese. This updates your sparse-checkout patterns to include only the requested translation, and Git fetches the necessary files on demand without requiring a full repository reclone.

### Does sparse checkout affect the functionality of the curriculum notebooks?

No, the core curriculum in the `lessons/` directory and the quiz application in `etc/quiz-app/` function identically regardless of whether translations are present. All Python dependencies specified in [`environment.yml`](https://github.com/microsoft/AI-For-Beginners/blob/main/environment.yml) and the notebook code references remain valid, as the curriculum code has no dependencies on the translation assets stored in separate directories.