Section 7 Git (part two)
In this section we will learn a typical workflow of pulling and pushing our files and data between local git and remote github repositories. In the next section we will explore some of the GitHub platform specific features that will helps us with sharing our research.
As was discussed in previous section we need to link our local git repository with the remote one at the github platform.
For some odd reason you can’t simply copy and paste github remote address into relevant section of the setup window using RStudio client. In the figure 7.1 below, input box “Origin” is grayed out. I have tried and I cannot find a way to update that via RStudio client interface.
Steps were described in git init section of the book on how to get to that dialog popup.
7.3 “origin” lingo in git
Origin in the context of git means remote location for your git repository. It is a key (short hand representation) for our URL for when we are pushing and pulling code between local and remote repositories. We don’t have to use “origin” key name, we can use any other names, for example
project_x_github_repo. The only caveat to that RStudio client won’t be able to understand that keyword.
If you would like to try this out, run the following commands in the R console
7.4 git push
We have already learned how to checkpoint our files with git commit in the previous section. Let’s now synchronise our local repository with remote github one by pressing on green arrow up button “push” in the “Git” tab. We will be prompted to enter our github username and the password.
Let’s switch to GitHub window in our web browser, update the webpage to see our code appearing on the remote GitHub platform.
— marvelous !
7.5 git pull
git pull is a complementary command to
git push, which is actually does two things
git fetch - bring remote changes to your local repository and
git merge synchronise files between local and remote copies.
We will stop our git journey here. If you would like to learn more about git and github look into the resource mentioned in the opening of this part.
— sad :’(