Skip to content

Commit aecc5fa

Browse files
committed
Add more info to git with RStudio
1 parent 8891941 commit aecc5fa

File tree

3 files changed

+14
-27
lines changed

3 files changed

+14
-27
lines changed

episodes/14-supplemental-rstudio.md

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,46 +133,33 @@ would tell us:
133133

134134
![](fig/RStudio_screenshot_viewhistory.png){alt='RStudio screenshot showing the "Review Changes" dialog after pressing the "History" button. The top panel lists the commits in the repository, similar to git log. The bottom panel shows the changes included in the commit that has been selected in the top panel.'}
135135

136-
RStudio creates a number of files that it uses to keep track of a project. We
137-
often don't want to track these, in which case we add them to our `.gitignore`
138-
file:
136+
Now that you've confirmed your commit history locally using the Git pane in RStudio, you can head over to GitHub to see the same history reflected in your repository online.
139137

140-
![](fig/RStudio_screenshot_gitignore.png){alt='RStudio screenshot showing .gitignore open in the editor pane with the files .Rproj.user, .Rhistory, .RData, and \*.Rproj added to the end'}
141-
142-
::::::::::::::::::::::::::::::::::::::::: callout
143-
144-
## Tip: versioning disposable output
145-
146-
Generally you do not want to version control disposable output (or read-only
147-
data). You should modify the `.gitignore` file to tell Git to ignore these
148-
files and directories.
138+
To view it, go to your repository page and click on the "Commits" link near the top.
149139

140+
![](fig/github_screenshot_find_commit_history_edited.png){alt='GitHub screenshot showing where to find the commit history button.'}
150141

151-
::::::::::::::::::::::::::::::::::::::::::::::::::
152-
153-
::::::::::::::::::::::::::::::::::::::: challenge
142+
This will open a list of all commits, showing who made each change and when.
154143

155-
## Challenge
144+
![](fig/github_screenshot_history_edited.png){alt='GitHub screenshot showing commit history.'}
156145

157-
1. Create a new directory within your project called `graphs`.
158-
2. Modify the `.gitignore` so that the `graphs` directory is not version controlled.
146+
After seeing how your commit history appears on GitHub, you can be confident that your changes have been successfully pushed and recorded.
159147

160-
::::::::::::::: solution
148+
Next, let’s take a look at how RStudio quietly helps manage your repository by automatically updating the `.gitignore` file.
161149

162-
## Solution to Challenge
150+
When you create a *New Project* in RStudio, it generates an *.Rproj file and a hidden folder called `.Rproj.user`. These are used to store project-specific settings and user preferences.
163151

164-
This can be done in Rstudio:
152+
RStudio recognizes that these files typically shouldn’t be tracked in version control, so it automatically adds `.Rproj.user` to your existing `.gitignore` file.
165153

166-
```r
167-
dir.create("./graphs")
168-
```
154+
Notice that the `.gitignore` file was modified and appears as a changed file in the Git tab on the right-hand side panel.
169155

170-
Then open up the `.gitignore` file from the right-hand panel of Rstudio and add
171-
`graphs/` to the list of files to ignore.
156+
![](fig/RStudio_screenshot_gitignore.png){alt='RStudio screenshot showing .gitignore open in the editor pane with the .Rproj.user folder added to the end.'}
172157

158+
::::::::::::::::::::::::::::::::::::::: challenge
173159

160+
## Push the .gitignore changes to GitHub
174161

175-
:::::::::::::::::::::::::
162+
Consider adding other files to be ignored, such as recipes.Rproj, .Rhistory and .RData, and complete the process for saving RStudio's `.gitignore` file changes to your remote repository.
176163

177164
::::::::::::::::::::::::::::::::::::::::::::::::::
178165

107 KB
Loading
137 KB
Loading

0 commit comments

Comments
 (0)