HomeOther TutorialsVisual Studio Code Tutorials 〉Use Terminal and Git in Visual Studio Code | Built-in Tools Guide

Use Terminal and Git in Visual Studio Code | Built-in Tools Guide !

Use Terminal and Git in Visual Studio Code | Built-in Tools Guide !

Summary

With VS Code's integrated terminal and Git support, you can run commands, manage repositories, and push to GitHub without leaving your editor. This improves productivity and keeps everything in one place.

Introduction

Are you tired of switching between your code editor and terminal? Or confused about how to use Git without leaving VS Code? Good news: Visual Studio Code has a powerful built-in terminal and Git integration that simplifies your development workflow. Whether you're committing code, pushing to GitHub, or installing packages with npm — you can do it all without leaving the editor!

In this tutorial, you'll learn:

  • How to open and use the integrated terminal in VS Code.
  • How to initialize a Git repository.
  • How to commit, push, and pull code using Git tools built right into VS Code.

How to Open the Integrated Terminal in VS Code

The integrated terminal lets you run shell commands directly inside VS Code.

Steps:

  1. Open your project in VS Code.
  2. Use the shortcut: Ctrl + ` (backtick), or go to View > Terminal.
  3. A terminal window appears at the bottom — this is your workspace shell.

Tip:

You can open multiple terminals by clicking the + icon. You can also switch between Command Prompt, PowerShell, Git Bash, or Linux shell if installed.

Git Integration in Visual Studio Code

VS Code comes with Git built in. If Git is installed on your system, VS Code will detect it automatically. Learn more about Git

Initialize a Git Repository:

  1. Open your project folder in VS Code.
  2. Go to Source Control Panel (shortcut: Ctrl + Shift + G).
  3. Click “Initialize Repository” if you haven't already.

Make Your First Commit:

  1. Make changes to your code.
  2. You'll see modified files listed in the Source Control panel.
  3. Write a commit message in the input box.
  4. Click the ✔️ icon to commit the changes.

Push & Pull to GitHub

To work with remote repositories like GitHub:

Steps:

  1. Make sure your local repo is connected to a remote repo using:
    git remote add origin https://github.com/your-username/your-repo.git
  2. Use the terminal or Source Control panel to push:
    git push -u origin main
    Or use the GUI: Click the menu > Push.
  3. To pull changes:
    git pull origin main

VS Code shows all Git status indicators like changes, conflicts, or staging — making version control visual and easy.

GitLens Extension (Optional but Recommended)

For enhanced Git features in VS Code, install GitLens from the Extensions Marketplace. It offers:

  • Line-by-line commit history
  • Blame annotations
  • Visual Git graphs

Install it by going to Extensions (Ctrl + Shift + X) and searching for GitLens.

Related Topics:

Frequently Asked Questions (FAQs)

How do I switch terminal types in VS Code?

You can switch between shells by clicking the dropdown in the terminal tab or changing it via Terminal > Select Default Profile.

Do I need Git installed separately?

Yes. VS Code requires Git to be installed on your machine. Download Git here.

Can I resolve Git merge conflicts in VS Code?

Yes! VS Code provides a visual interface to resolve merge conflicts, with inline and side-by-side options.