> AI agents: For documentation discovery and navigation, see [llms.txt](/llms.txt).

# Version control in VS Code

In this tutorial, we will learn how to use the basics of Git version control in Visual Studio Code. For more information about integrated Git support, including how to work with remote repositories, read on in the [related resources](/docs/introvideos/versioncontrol.md#related-resources) section below.

[![Watch Using Git with Visual Studio Code on YouTube (opens in new tab).](images/versioncontrol/youtube-i_23KUAEtUM.jpg)](https://www.youtube.com/watch?v=i_23KUAEtUM)

Here's the next video we recommend: [Customize](/docs/introvideos/customize.md)

Pick another video from the list: [Introductory Videos](/docs/getstarted/introvideos.md)

## Video outline

* Install Git
  * [https://git-scm.com](https://git-scm.com)
* Open Folder
  * **File** > **Open Folder** (`kb(workbench.action.files.openFolder)`)
* Source Control
  * **View** > **Source Control (SCM)** (`kb(workbench.view.scm)`)
* Initialize repository
  * `main` is the default branch
* Open the Command Palette.
  * **View** > **Command Palette** (`kb(workbench.action.showCommands)`)
* Rename a branch
  * **Git: Rename Branch**
* File version control status
  * **U** - Untracked file
  * **A** - Added file
  * **M** - Modified file
* Commit file
  * **Commit** ☑️(check mark) button
* Create a branch
  * **Git: Create Branch**
* Diff editor
  * Select **More Actions** (**...**) > **Diff View** in the diff editor toolbar, then choose **Inline**, **Side by Side**, or **Automatic**.
  * See [Choose a diff layout](/docs/sourcecontrol/staging-commits.md#choose-a-diff-layout) for details.
* Stage changes
  * **Stage Changes** ➕ button
* Switch branches
  * Status bar branch item (lower left)
* Merge branch
  * **Views and More Actions** (**...**) > **Branch** > **Merge Branch**
* Publish branch to GitHub
* Clone repository
  * **Git: Clone** > **Clone from URL**

## Next video

* [Customize](/docs/introvideos/customize.md) - Customize VS Code with settings and keyboard shortcuts.
* [Introductory Videos](/docs/getstarted/introvideos.md) - Review the entire list of videos.

## Related resources

* [Source Control](/docs/sourcecontrol/overview.md) - Read more about integrated Git support.
* [Working with GitHub](/docs/sourcecontrol/github.md) - Create and manage GitHub issues and pull requests.
* [Setup Overview](/docs/getstarted/overview.md) - Set up and start using VS Code.
