This page describes how to use version control for your application files with the Cloud Shell Editor's inbuilt Git support.
Using version control
By clicking on the Source Control: Git view from the Activity bar , you can access your Git repositories (or create a new one), view existing and staged changes, and merge changes.
From here, you can stage and unstage changes, diff between the previous state and the current version of files, and commit changes, all from within the Cloud Shell Editor.
Toggling between multiple repositories
You can work across multiple Git repositories with the Cloud Shell Editor. Within your Source Control: Git panel, your detected repositories are displayed along with their respective changed files. You can choose a scope by selecting one of the displayed repositories.
Displaying working changes
As you add, modify, and delete files, these changes are reflected under the Changes section in your Source Control: Git panel. You can choose to open the selected file, stage these changes, discard changes, or see what changes are being made in this commit.
Turning on diff view
Within the Source Control: Git panel, your changed files are listed under Changes and if you've staged them, under Staged Changes. Clicking any of these files brings up their diff view, showing you what's changed between the previously committed state of the file and the current state.
When you're ready to check in your changes, you can do so right from within the Cloud Shell.
First, run the following git commands using the Cloud Shell terminal:
git config --global user.email email@example.com git config --global user.name YourName
Then, back in the Source Control: Git panel in the Cloud Shell Editor, write a commit message and click commit (or press Cmd/Ctrl + Enter) to check in your change.
Cloning a repository
To clone a remote Git repository for use in the Cloud Shell Editor, all you need is the repository URL. For GitHub repositories, this is readily available under the Clone or Download dialog when viewing the main page of your repository.
Launch the Command Palette with Cmd/Ctrl+Shift+P and search for Git: Clone. Once selected, the Cloud Shell Editor prompts you for the Git repository location.
Creating and switching between branches
To create a new branch or switch to working on an existing branch, you need to launch the Command Palette with Cmd/Ctrl+Shift+P and search for Git: Checkout. Once selected, select from the list of branches or create a new local branch.
Git status bar
In addition to the Command Palette, you can keep track of your current branch and switch to another with the branch indicator in the Git status bar.
Additionally, you can use the Synchronize Changes action to check for changes between your local repository and your upstream branch. Synchronizing changes pushes local changes to your upstream branch and pulls remote changes into your local repository.
If you don't have an upstream branch set up, the Publish action is available to push your local changes to a remote repository.