0:00
So, you've had a chance to see how we've made changes in RStudio on the local computer.
And then we stage or added the files committed,
and we pushed those changes up to the cloud.
But what about going the other direction?
It turns out inside of github.com when you're logged into your GitHub repository,
you can actually make changes here.
So click on the README file,
and when this comes up there's
a little button at the right that looks a little bit like a pencil.
You'll notice if you highlight over this,
it says edit this file,
go ahead and click that.
You're now basically editing your README file inside of your browser.
So, we're going to add a second line of text from the GitHub editor.
If you like, you can click on the little button that looks like
an eyeball for preview changes,
and it'll show you that here are the changes.
You'll notice MyFirstRepo is a header,
followed by a couple of lines of text.
And the second line that we just added has a little green bar next to it.
Again, this is version control,
it's showing you what change is happening in this edit.
We scroll down to the bottom.
Let's go ahead and commit our changes.
We need to add a comment here.
So, we added a second line of text to ReadMe.
We're going to commit this by clicking the button for commit changes.
1:29
You'll notice that this change was just made.
However, this doesn't yet exist on our local drive.
So let's go back to our studio.
From here, you'll notice that the ReadMe file does not have the second line of text.
And further, in the Git tab you don't notice any changes.
This is because the GitHub account is actually a little bit ahead of our local drive.
One way to always check to see if
their pod account is ahead of your local drive is to click pull.
When we click pull,
you'll notice that it says that it's doing an update.
That the ReadMe file had one file change with two insertions.
Now, what is on our local drive is the same as what is in our GitHub account.
So now, you've successfully done a push and pull using RStudio.
But I want to show you a couple more things.
So let's go back to RStudio and let's edit the ReadMe file one more time,
we're going to add a third line of text.
And this time we're going to click save but instead of using RStudio to do the commit,
let's go back to the Git Bash Window.
So, go ahead and open that app and double check,
make sure that you are in the right directory for RepTemplates, MyFirstRepo.
And instead of using RStudio to do the stage commit and push,
we're going to do it using Git Bash.
The reason that I want to show you this is that when you have more complicated projects,
and you've made a lot of changes,
or you've got a lot of files that you need to commit,
sometimes RStudio is not the most efficient interface to do this.
The Git Bash Window is still going to be your best bet.
So, it's always a good idea to run Git status.
You'll notice that it shares our branches up to
date but there are changes that have not been yet staged.
We have one file that's been modified to README.md.
So, to do this we need to stage or add the files by typing
Git add followed by a dot which pretty much means let's add everything.
Next we need to do the commit and we need to type in a comment,
so changes to ReadMe third new line of text.
Click enter, and finally we need to do a push.
Couple of things will happen when do this.
You'll notice that in the Git Bash Window it
says that we've got the objects been created,
the changes have been made.
And now, if I go back and click in
the RStudio window in the Git tab the commits and the changes that you saw are now gone.
This is because we've already executed all of the Git commands and RStudio sees that,
and knows that there are no new changes.
Let's go back to your GitHub account,
refresh and now if we look at our ReadMe File we have that third new line of text.
The last change I'm going to show you,
let's do one more change here in the web,
we'll click on edit, we're going to add one more line of text,
so add fourth line of text to your ReadMe File.
So, we've added a fourth line text to ReadMe, click commit.
Again, we could do this using RStudio,
but instead we're going to use the Git Bash Window and the command is very simple.
We just type Git pull and it should now pull down those changes.
So you'll notice as soon as I did that using
the Git Bash Window the changes show up here in RStudio.
We now see there's a fourth line of text,
and we can see all the files.
So, everything that is on our local drive is the
same as what is here in our GitHub account.
So congratulations.
I know this is a long lesson,
but you've accomplished quite a bit.
You've got all of the software installed.
Everything is up and running,
and you've got everything connected using version control,
linking GitHub down to your local hard drive.
This is quite an accomplishment and something
that not many people take the time and effort to do.
So feel proud. This is a major milestone.