[MUSIC PLAYING]
SPEAKER 1: Cloud Shell Editor gives you
the power to easily write code from your web browser
and deploy it to the Cloud.
In previous videos, we learned how
to deploy applications to Cloud Run and Google Kubernetes
Engine.
We also learned about the Cloud code integration,
and how it provides convenient tools to debug applications
and use Google Cloud APIs.
But what if you want to collaborate with teammates?
Cloud Shell Editor has you covered
with version control and support for multiple projects.
Let's take a look and learn more.
First, visit ide.cloud.google.com
to launch Cloud Shell Editor.
Cloud Shell Editor gives you the power
to manage multiple projects as Workspaces.
A Workspace usually represents the root folder
of your project, as well as project-specific configuration
files.
With Workspaces, you can specify persistent settings, run
and debug configurations and UI states
for all the folders in your Workspace.
Here we can see some recent Workspaces for this user.
To open the Home Workspace that's
created for you automatically, click Open Home Workspace.
This opens up the Home Workspace,
displaying all of its folders and files
in the Explorer panel.
To create a new Workspace, we'll first
want to create a new directory to use as our Workspace.
Right-click on the Explorer panel and select New Folder.
Give your new folder a name and click OK.
Let's also go ahead and add a new file to this folder.
Once your directory is ready, you
can open it as a new Workspace with File, Open, Workspace.
You can also configure settings for your individual Workspaces.
Settings are accessible by opening File, Settings, Open
Preferences.
Here you can adjust two different types of settings--
User settings and Workspace settings.
User settings apply to all your instances
of Cloud Shell Editor, while Workspace settings apply only
to your currently active Workspace.
Closing a Workspace is easy.
Just select File, Close, Workspace.
This will bring you back to the Cloud Shell Editor homepage.
Now let's learn about how to use source control with Git
from Cloud Shell Editor.
Click Open, Home, Workspace to open your Home Workspace.
Now let's go ahead and clone some sample code from GitHub.
Open the command palate by selecting View, Find, Command.
Type "Git Clone" and click on it.
Next, you'll be prompted to type in the Git repository
that you want to clone.
After typing in a GitHub URL, press Enter to continue.
Cloud Shell Editor clones the files
for a sample application from GitHub into a new folder,
allowing you to work across multiple repositories
at the same time.
Right-click on the folder created
for your new repository, and select Open as Workspace.
You should see the list of code files only for this repository.
Here we have a simple Python Flask web application.
Now let's try editing the code and pushing the change
to GitHub.
Open the main.py File and replace "Hello World" with
"Hello Google."
Cloud Shell Editor will save your changes automatically.
On the left side of your screen, you
should see that the source control icon has a blue circle
with the "1" inside it.
This means that we have a new code
change we may want to commit.
Click on the source control icon to open the source control Git
panel.
Now we see that we have a code change in main.py
You can click on it to open the [? DifView, ?]
which shows what you've changed versus a previous commit.
Hover over the main.py file in the source control Git panel,
and click the plus by it to save your changes.
When you're ready to check in your changes,
you can do so directly within Cloud Shell Editor.
But first, you'll need to configure Git.
Select Terminal, New Terminal, to open a new Cloud Shell
terminal window.
From here, run the following two commands
to set up Git from command line.
[MUSIC PLAYING]
Then, back in the source control Git panel,
write a commit message and click the checkmark
to check in your code change.
Now you're ready to push your change to GitHub.
Back in the Cloud Shell terminal window, run Git push.
Type in your GitHub username and password
to push your commit to the master branch.
Let's head over to GitHub to verify that our change was
actually pushed successfully.
Based on the information about the latest commit,
it looks like we're good to go.
You can also manage source control from the Git status bar
at the bottom of your screen.
Right now we're on the main branch,
but we can click on it to switch to a different branch,
or create a new branch.
There's also a Synchronize Changes button.
Synchronizing changes pushes local changes
to your upstream branch, and pulls remote changes
into your local repository.
With just a couple of clicks, we're
able to get started with source control
and push a change to a Git repo.
If you want to experience for yourself all that Cloud Shell
Editor has to offer, just visit ide.cloud.google.com,
where we have interactive tutorials to help you get
started.
From more videos on Cloud Shell Editor and a whole lot more,
make sure to subscribe to the channel.
[MUSIC PLAYING]