Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make rerelease changes part 2 #56

Merged
merged 8 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion episodes/01-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@
Google Docs' [version history](https://support.google.com/docs/answer/190843?hl=en), or
LibreOffice's [Recording and Displaying Changes](https://help.libreoffice.org/Common/Recording_and_Displaying_Changes). Let's illustrate how Google Docs works.

![Tracking changes for the `git-test` file.](fig/gdocs-01.png)

Check warning on line 63 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/gdocs-01.png

To use Google Docs version history click `File` > `Version history` > `See version history`. This highlights the new content added to the file in that version only.

![The most recent version of the `git-test` file is called "third version".](fig/gdocs-03.png)

Check warning on line 67 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/gdocs-03.png

We can move to any previous version tagged with two metadata values: the modification date and the name of the author.

![We can view the "first version" of the file `git-test`. We can also restore it with the `Restore this version` button.](fig/gdocs-04.png)

Check warning on line 71 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/gdocs-04.png

Google Docs’ version history tool is an automatic Version control system for single Word/Doc files that works online.

![The Turing Way project illustration by Scriberia. Used under a CC-BY 4.0 licence. DOI: <https://zenodo.org/doi/10.5281/zenodo.3332807>.](fig/ProjectHistory.jpg)

Check warning on line 75 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/ProjectHistory.jpg

## Version control systems

Expand Down Expand Up @@ -165,24 +165,34 @@

Plain text files can be text, code, and data. Example for each of these are Markdown files (`.md`), R files (`.R`), and `.csv` or `.tsv` files, respectively.

![Examples of non-plain and plain text files.](fig/plain-text-files.png)

Check warning on line 168 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/plain-text-files.png

::::::::::::::::: callout

We can use `Git` to track changes of these plain text files. However, for [plain text data files](https://www.r4epi.com/importing-plain-text-files.html) (like `.csv` and `.tsv`) we prefer different version control systems.
### data files

We can use `Git` to track changes of **data files** (like `.csv` and `.tsv`). However, if we consider data files as **raw files**, which should not change in time, then we may not be needed to use Git with them. We'll take a look into this in the chapter on [Ignoring things](06-ignore.md).

Also, if you consider your data file **large** with respect to your computer, you can opt to use:

- a file hosting service like Google Drive and the [`{googlesheets4}` R package](https://r4ds.hadley.nz/spreadsheets#google-sheets) to import data,
- a different version control system like [Git Large File Storage (LFS)](https://git-lfs.github.com/), or
- a different data format like the `parquet` format using [the `{arrow}` R package](https://r4ds.hadley.nz/arrow.html).

<!-- [plain text data files](https://www.r4epi.com/importing-plain-text-files.html) -->

:::::::::::::::::::::::::

Plain text files like Markdown files (`.md`) and R files (`.R`) are integrated in Rmarkdown files (`.Rmd`) to generate manuscripts, websites, and R packages. These three products are outputs of **Open Science** projects, that leads to *Reproducible research* and *Sustainable software*.


![We can increase the reproducibility of our Open science projects with version control sytems like `Git`. Text and final results can be connected and executable by Data and code. From: "Ciencia reproducible: qué, por qué, cómo" <https://www.revistaecosistemas.net/index.php/ecosistemas/article/view/1178>](fig/gradient-reproducibility.png)

Check warning on line 189 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/gradient-reproducibility.png

::::::::::::::::::: instructor

### Concept map

![Concept map for automatic version control.](fig/git-concept-03.drawio.png)

Check warning on line 195 in episodes/01-basics.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/git-concept-03.drawio.png

::::::::::::::::::::::::::::::

Expand Down
4 changes: 3 additions & 1 deletion episodes/02-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

In this episode, we are going to use the [Rstudio Console](https://docs.posit.co/ide/user/ide/guide/code/console.html).

![Visual appearance of the Console.](fig/rstudio-tab-console.png)

Check warning on line 48 in episodes/02-setup.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/rstudio-tab-console.png

::::::::::::::::::::::::::

Expand Down Expand Up @@ -100,7 +100,7 @@

::::::::::::::::::::::::::::::::::::::::: callout

## Keeping your email private
### Keeping your email private

If you elect to use a private email address with GitHub, then use that same email address for the `user.email` value, e.g. `[email protected]` replacing `username` with your GitHub one.

Expand Down Expand Up @@ -197,12 +197,14 @@

Click “Generate token”.

![Visual display with the recommended scopes selected. Optional scopes are "gist" and "delete_repo" to create a [gist](https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists) and delete repositories.](fig/git-token.png)

Check warning on line 200 in episodes/02-setup.md

View workflow job for this annotation

GitHub Actions / Build markdown source files if valid

[image missing alt-text]: fig/git-token.png

Copy your token. Save it for the next step.

::::::::::::::::: callout

### token options

Briefly:

- `"repo"` will give you control of your _private_ repositories online (YES! you can have private repos!).
Expand Down
144 changes: 81 additions & 63 deletions episodes/04-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,86 @@ than you would like!

:::::::::::::::::::::::::::

## Group Challenges

::::::::::::::::::::::::::::::::::::::: challenge

## Choosing a Commit Message

Which of the following commit messages would be most appropriate for the
last commit made to `sitrep.Rmd`?

1. "Changes"
2. "Added line 'Maps illustrate the spread and impact of outbreak' to sitrep.Rmd"
3. "Discuss effects of Sitrep' climate on the Mummy"

::::::::::::::: solution

## Solution

Answer 1 is not descriptive enough, and the purpose of the commit is unclear;
and answer 2 is redundant to using "git diff" to see what changed in this commit;
but answer 3 is good: short, descriptive, and imperative.



:::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::: challenge

## Committing Changes to Git

Which command(s) below would save the changes of `myfile.txt`
to my local Git repository?

1. ```bash
$ git commit -m "my recent changes"
```
2. ```bash
$ git init myfile.txt
$ git commit -m "my recent changes"
```
3. ```bash
$ git add myfile.txt
$ git commit -m "my recent changes"
```
4. ```bash
$ git commit -m myfile.txt "my recent changes"
```

::::::::::::::: solution

## Solution

1. Would only create a commit if files have already been staged.
2. Would try to create a new repository.
3. Is correct: first add the file to the staging area, then commit.
4. Would try to commit a file "my recent changes" with the message myfile.txt.



:::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::


::::::::::::::::::::::::::: testimonial

### Your turn!

Take 10 minutes to the following two sections:

- Practice the workflow
- Relevant callouts

If you want to keep practicing, move to the last one:

- Individual Challenges

:::::::::::::::::::::::::::

## Practice the workflow

Let's watch as our changes to a file move from our editor to the staging area and into long-term storage. First, __in the Console__, we'll add another line to the file:
Expand Down Expand Up @@ -831,69 +911,7 @@ repository (`git commit`):

![](fig/git-committing.svg){alt='The Git Commit Workflow'}

## Challenges

::::::::::::::::::::::::::::::::::::::: challenge

## Choosing a Commit Message

Which of the following commit messages would be most appropriate for the
last commit made to `sitrep.Rmd`?

1. "Changes"
2. "Added line 'Maps illustrate the spread and impact of outbreak' to sitrep.Rmd"
3. "Discuss effects of Sitrep' climate on the Mummy"

::::::::::::::: solution

## Solution

Answer 1 is not descriptive enough, and the purpose of the commit is unclear;
and answer 2 is redundant to using "git diff" to see what changed in this commit;
but answer 3 is good: short, descriptive, and imperative.



:::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::: challenge

## Committing Changes to Git

Which command(s) below would save the changes of `myfile.txt`
to my local Git repository?

1. ```bash
$ git commit -m "my recent changes"
```
2. ```bash
$ git init myfile.txt
$ git commit -m "my recent changes"
```
3. ```bash
$ git add myfile.txt
$ git commit -m "my recent changes"
```
4. ```bash
$ git commit -m myfile.txt "my recent changes"
```

::::::::::::::: solution

## Solution

1. Would only create a commit if files have already been staged.
2. Would try to create a new repository.
3. Is correct: first add the file to the staging area, then commit.
4. Would try to commit a file "my recent changes" with the message myfile.txt.



:::::::::::::::::::::::::

::::::::::::::::::::::::::::::::::::::::::::::::::
## Individual Challenges

::::::::::::::::::::::::::::::::::::::: challenge

Expand Down
27 changes: 25 additions & 2 deletions episodes/06-ignore.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ a.csv
Use -f if you really want to add them.
```

::::::::::::::::::::::: spoiler

### How to override our ignore settings?

If we really want to override our ignore settings,
we can use `git add -f` to force Git to add something. For example,
`git add -f a.csv`.
Expand All @@ -155,6 +159,8 @@ Ignored files:
nothing to commit, working tree clean
```

:::::::::::::::::::::::

::::::::::::::::: checklist

### Good Practice
Expand All @@ -169,7 +175,22 @@ A good version control project:

:::::::::::::::::::::::::::

## Challenges
::::::::::::::::::::::::::: testimonial

### Your turn!

Take 5 minutes to the following two challenges:

- Ignoring Nested Files
- Including Specific Files

If you want to keep practicing, move to the last one:

- Home challenges

:::::::::::::::::::::::::::

## Live challenges

::::::::::::::::::::::::::::::::::::::: challenge

Expand Down Expand Up @@ -229,7 +250,7 @@ How would you ignore all `.csv` files in your root directory except for

::::::::::::::: hint

Find out what `!` (the exclamation point operator) does in the [Git Reference documentation](../learners/reference.md) for `gitignore`.
Find out what `!` (the exclamation point operator) does for `gitignore` in the [Git Reference documentation](../learners/reference.md).

:::::::::::::::

Expand All @@ -256,6 +277,8 @@ of `.csv` files added to the root directory will be ignored.

::::::::::::::::::::::::::::::::::::::::::::::::::

## Home challenges

::::::::::::::::::::::::::::::::::::::: challenge

## Ignoring Nested Files: Variation
Expand Down
Loading
Loading