Using the integrated Git
To use the features that involve Git, you must install Git and have it available in your system path so that VS Code can display it. On Macs, Git comes out of the box. On Linux, you can install Git with your distribution's package manager. On Windows, you can get Git from https://git-scm.com.
Creating Git branches
To manage your codes for parallel development, you can create a new branch using the integrated Git. To create a new Git branch:
- Select the branch icon at the lower left of the browser page in the colored status bar. A drop-down box at the top of the browser page appears with various options.
- Select the branch icon at the bottom again and then
Create new branch....
- Enter the name of the new branch.
Committing changes into Git branches
After making code changes and refinements, you can commit changed files to the Git repository.
To commit changed files:
Open the Git view by clicking
View > Git, or pressing
Ctrl+Shift+G(Windows and Mac), which lists all the files that you added or modified.
To review changes to a changed file that is marked by the
M, double-click the file to open a diff editor view.
Take one of the following actions:
- Open the file.
- Discard changes.
- Add your file for the next commit that is called Staging by clicking the
+icon to stage it.
Provide a short description in the
Commit messagetext box at the top, such as
Implemented Update Report.
Make sure that the branch you want to commit to is selected at the bottom of the browser page.
Commiton the top of the Git view. The list of files is empty now as all changes were committed to the branch.
You can review these changes in the Git History viewer after completing the commit.
For more information about using Git, see VS Code documentation.