---
title: "Version Control"
description: "Save an extra back up of your project files in the cloud, keep a history of all code changes, and easily revert changes to your projects."
canonical: https://www.quantconnect.com/docs/v2/lean-cli/projects/version-control
markdown: https://www.quantconnect.com/docs/v2/lean-cli/projects/version-control.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/05%20Lean%20CLI/06%20Projects/99%20Version%20Control
modified: 2026-10-29
index: https://www.quantconnect.com/llms.txt
---

# Version Control

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Lean CLI](https://www.quantconnect.com/docs/v2/lean-cli.md) > Projects > Version Control

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Version control is the practice of tracking and managing changes to code files. By using version control, you can save an extra back up of your project files in the cloud, keep a history of all code changes, and easily revert changes to your projects.

To use the CLI, you must be a member in an [organization](https://www.quantconnect.com/docs/v2/cloud-platform/organizations/tier-features.md) on a paid tier.

## Create Workspace Repositories

Follow these steps to set up a new version control repository for one of your [organization workspaces](https://www.quantconnect.com/docs/v2/lean-cli/initialization/organization-workspaces.md):

1. In your version control system, [create a new repository](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-new-repository) for the organization workspace.
2. Open a terminal in your organization workspace and then [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) the new repository to a temporary directory.
   ```
   $ git clone https://github.com/<userName>/<repoName>.git temp
   ```
3. Move the `.git` directory from the temporary directory to the workspace directory.
   ```
   $ mv temp/.git <workspaceDirectory>/.git
   ```
4. Delete the temporary directory.
   ```
   $ rm -r temp
   ```

## Push Changes to Git

Follow these steps to push the changes of your organization workspace to your version control system:

1. [Pull all your cloud projects](https://www.quantconnect.com/docs/v2/lean-cli/projects/cloud-synchronization.md#02-Pulling-Cloud-Projects), creating directories where necessary.
   ```
   $ lean cloud pull
   ```
2. Add the project directories and the `Library`.
   ```
   $ git add Library/
   $ git add <projectDirectory1>/
   $ git add <projectDirectory2>/
   ```
3. Commit the changes.
   ```
   $ git commit -am "Latest Updates"
   ```
4. Push the changes to the repository.
   ```
   $ git push
   ```
