Objectives: The objectives of this notebook are to:

Why Use Version Control?

Now that you’ve created a GitHub account, you can use GitHub to house repositories for projects that you’re working on. For example, I have a GitHub repository for most of the courses I teach. Those repositories house many of my course notes, old exams, projects, and more. Importantly, those repositories also track the evolution of these course materials. This means that if I try something new and don’t like how it turned out when I implemented it, I can simply revert the status of the repository back to its state prior to making those changes. This is a powerful upgrade from explicitly saving lots of different versions of files. Firstly, it is a much more organized approach and, secondly, it is safer and more reliable.

Creating a GitHub Repository

Creating a GitHub can be done in many ways. We’ll use the simplest method.

Using an R Project to Manage a GitHub Repository

Since you have RStudio configured to work with GitHub, you can now use RStudio to clone a copy of your repository to your local machine and to use RStudio to manage that GitHub repository.

Adding a File to your Repository

Any changes you make within the directory corresponding to the R project you just created will be tracked in the Git tab. You’ll see a list of changed files here that need to be synced to your remote repository on GitHub. Right now that tab is empty though. Let’s change that.


Next Steps

Now that you’re using RStudio to manage your GitHub repository, let’s make this notebook into something meaningful.

When you are done, knit your document and then sync your changes to GitHub using the Pull -> Commit -> Push workflow.