You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content_development/Task_3.md
+57-20Lines changed: 57 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ This task is designed for students and researchers who want to implement a syste
10
10
11
11
Don't forget you can join in the discussions over at our open [**Slack channel**](https://openmooc-ers-slackin.herokuapp.com/). Please do introduce yourself at #module5opensource, and tell us a bit about who you are, your background, and how you ended up here!
12
12
13
-
Estimated time to complete:
13
+
Estimated time to complete: 30 minutes
14
14
15
-
Estimate time saving once complete:
15
+
Estimate time saving once complete: Virtually infinite
16
16
17
17
## Table of contents
18
18
@@ -30,19 +30,19 @@ Estimate time saving once complete:
30
30
31
31
## Getting started <aname="Getting_started"></a>
32
32
33
-
Congratulations on making it this far! If you're reading this, you've survived pull requests, webhooks, and can probably even tell us know what the F in FOSS stands for (*not* Frustration, or any other F-word not often related to Open Source Software). Hopefully, you have overcome any skepticism or reluctance towards the benefits of GitHub and Open Source Software, and are ready to take the next step.
33
+
Congratulations on making it this far! If you're reading this, you've survived pull requests, webhooks, and can probably even tell us know what the F in FOSS stands for (*not* Frustration...) Hopefully, you have overcome any skepticism or reluctance towards the benefits of GitHub and Open Source Software, and are ready to take the next step.
34
34
35
35
Before starting this Task, make sure you have already completed [Task 1](https://github.com/OpenScienceMOOC/Module-5-Open-Research-Software-and-Open-Source/blob/master/content_development/Task_1.md) and [Task 2](https://github.com/OpenScienceMOOC/Module-5-Open-Research-Software-and-Open-Source/blob/master/content_development/Task_2.md), so that you are more familiar with GitHub and some standard Open Source practices.
36
36
37
-
This task will teach you how to integrate the version control software, Git, with the popular coding environment, R Studio. And yes, it is Git as in gif or God, not Jit as in the wrong way of pronouncing things.
37
+
This task will teach you how to integrate the version control software, Git, with the popular coding environment, RStudio. And yes, it is Git as in gif or God, not Jit as in the wrong way of pronouncing things.
38
38
39
39
If you are one of those researchers who thinks that having code spread across multiple hard-drives that are waiting to break, Dropbox, Google Drive, or any other non-specialist software, this task is just for you. All of us are guilty of this sort of thing once in a while, but there are ways to do it that are better for you, future you, and those who might benefit from your work.
40
40
41
41
<br/>
42
42
43
43
### Geting Git <aname="Git"></a>
44
44
45
-
So, what is Git, and how is it different to GitHub? Git is a version control system, which enables you to save time-stamped copies of your work throughout the development process. It also works with non-code items too, like again, this MOOC, the majority of which was written in markdown in R Studio, and integrated with a Git/GitHub workflow.
45
+
So, what is Git, and how is it different to GitHub? Git is a version control system, which enables you to save and track time-stamped copies of your work throughout the development process. It also works with non-code items too, like this MOOC, the majority of which was written in markdown in R Studio, and integrated with a Git/GitHub workflow.
46
46
47
47
This is important, as all research goes through changes, and some times we want to know what those things were. Did you delete some text that you now think is important? Version control will save that for you. Did your code used to work perfectly, but is now buggy beyond belief? Version control. It's a great way to avoid that chaotic state where you have multiple copies of the same file, but without a stupid and annoying file naming convention. `FINAL_Revised_2.2_supervisor_edits_ver1.7_scream.txt` will be a thing of the past.
48
48
@@ -54,8 +54,6 @@ This is important, as all research goes through changes, and some times we want
54
54
55
55
<br/>
56
56
57
-
58
-
59
57
GitHub is the platform that allows you to seamlessly share code from your workspace (e.g., laptop) to be hosted in an online space. So, sort of like the public interface to GitHub. The advantages of this are:
60
58
61
59
1. You get to keep copies of all your work through time;
@@ -65,22 +63,29 @@ GitHub is the platform that allows you to seamlessly share code from your worksp
65
63
5. You can see who made a change, why they made, and when;
66
64
6. You can have multiple people working on the same project at once in parallel.
67
65
66
+
<br/>
68
67
69
68
### RStudio <aname="Rstudio"></a>
70
69
71
-
R studio is a popular coding environment for researchers who use the statistical programming language, R. It comes with a text editor, so you don't have to install another and switch between. It also includes a graphical user interface (GUI) to Git and GitHub, which we will be using here.
70
+
RStudio is a popular coding environment for researchers who use the statistical programming language, R. It comes with a text editor, so you don't have to install another and switch between. It also includes a graphical user interface (GUI) to Git and GitHub, which we will be using here.
72
71
73
72
Isn't it nice when brilliant Open Source tools integrate seamlessly like that.
74
73
75
74
If at any point you need to install new packages for R, simply use the following command:
Replacing `PACKAGE NAME` with the, er, package name. Some examples you can play with that might come in useful include `knitr` or `ggplot2`.
80
83
84
+
<br/>
85
+
81
86
## Step one: Download all the things <aname="one"></a>
82
87
83
-
1. You should already have a GitHub account by now. If not, [sign up here](https://github.com/). Free unlimited repositories for all!
88
+
1. You should already have a GitHub account by now if you have followed the previous tasks. If not, [sign up here](https://github.com/). Free unlimited repositories for all!
84
89
2. Download and install the latest version of [R](https://www.r-project.org/). Also available for [Mac](https://cloud.r-project.org/) and [Linux](https://cloud.r-project.org/bin/linux/).
85
90
3. Download and install the latest version of [Rstudio](https://www.rstudio.com/products/rstudio/#Desktop). Oh, hey, looks it Open Source! Swish.
86
91
4. Download and install the latest version of [Git](https://gitforwindows.org/). **Make sure to Select “Use Git from the Windows Command Prompt” during installation.**
@@ -89,37 +94,69 @@ Replacing `PACKAGE NAME` with the, er, package name. Some examples you can play
89
94
90
95
For now, just choose all the usual default options for each install. Depending on which Operating System (e.g., Mac, Windows, Linux), this might be different for each of you. For now, and for the rest of this task, we're going to stick with doing things the easy-ish Windows way (but also provide some instructions for using the command line).
91
96
92
-
If you want, you can also download the [local version of GitHub](https://desktop.github.com/) and use it through the simple GUI - Graphical User Interface. It's available on Windows and Mac and Linux, and can make your life a little easier, especially if you want to use a different platform to RStudio.
97
+
If you want, you can also download the [local version of GitHub](https://desktop.github.com/) and use it through the simple GUI. It's available on Windows and Mac and Linux, and can make your life a little easier, especially if you want to use a different platform to RStudio.
98
+
99
+
> **Pro-tip:** You see when installing Git it says 'Use Git Bash as shell for Git projects?' This is the place where you can use the command-line to access Git from outside of RStudio. It's a powerful beast. Try the following two commands to get started:
Right, that's the easy bit done. Next, go into RStudio, and in the tabs at the top go to Go to **Tools > Options > Git/SVN**. SVN is just another version control system like Git, and we don't need to worry about that here.
109
+
Right, that's the easy bit done. Next, go into RStudio, and in the tabs at the top go to Go to **Tools > Global Options > Git/SVN**. SVN is just another version control system like Git, and we don't need to worry about that here.
97
110
98
-
In the place where it says 'Git executable', add the pathway here to the git.exe file that you just downloaded. Make sure all the boxes here are ticked.
111
+
In the place where it says *Git executable*, add the pathway here to the git.exe file that you just downloaded in the previous step. Make sure all the boxes here are ticked.
> **Pro-tip:** You see here where it says 'Use Git Bash as shell for Git projects?' This is the place where you can use the command-line to access Git from outside of RStudio. It's a powerful beast. If you want to play with this, try using the following simple commands:
117
+
<palign="center"><i>The Global Options window inside RStudio</i></p>
103
118
119
+
<br/>
120
+
121
+
Next, hit the button in this window that says *Create RSA Key*, This is a private key that is used for authentication between different systems. Here, it will pop up a new window with a public key, that you want to copy to your clipboard.
122
+
123
+
Head over to GitHub, go to your profile settings, and the *SSH and GPG keys* tab. Click *New SSH key*. Here, paste in the key from RStudio, and call it something imaginative like 'RStudio'.
<palign="center"><i>Inside GitHub where you will want to enter the key you just generated in RStudio</i></p>
130
+
131
+
<br/>
132
+
133
+
OK, now hold on to your butts, we're going into the commandline. Back in RStudio, go to **Tools > Shell**, and it will open up a command prompt window. If you already played with the Git Bash above, you should have done this step already. Enter the following two commands:
134
+
135
+
<br/>
104
136
`git config --global user.name 'YOUR USERNAME'`
137
+
<br/>
105
138
`git config --global user.email 'YOUR EMAIL'`
139
+
<br/>
106
140
107
141
Hopefully it does not have to be said to substitute in your own GitHub username and email here. You can access this at any point just by finding the 'Shell' within Windows. Or, if you right click on any folder on your Desktop that is linked to a GitHub repo, you can open up the Shell instantly and Bash away.
108
142
109
-
## Step three: Why did I just do that? <aname="three"></a>
143
+
What this stage has done is configure Git, which is software that runs on your desktop, to GitHub, which is a repository website.
144
+
145
+
Restart R Studio. Whew, that was tough. Next.
110
146
147
+
## Step three: Why did I just do that? <aname="three"></a>
111
148
112
-
OK, hold your breathe, we're going to learn some Git commands. Some of the key ones you could do with learning are:
149
+
OK, hold your breathe, we're going to learn some more Git commands. Some of the key ones you could do with learning are:
113
150
114
151
***Repository**: This is the location for all of the files associated with your project.
115
152
116
-
***Add**:
153
+
***Add**: This is where you submit files to the staging area before being committed.
117
154
118
-
***Commit**
155
+
***Commit** This is like 'saving' your work by creating a new version or copy.
119
156
120
-
***Push**:
157
+
***Push**: This is how you send files from your local project to the online repository.
121
158
122
-
***Pull**:
159
+
***Pull**: This is how you get files from your online repository to your local project.
123
160
124
161
## Step four: The perfect marriage between Git and R <aname="four"></a>
0 commit comments