Skip to content

Commit

Permalink
added exercise 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-van-Woudenberg committed Dec 13, 2024
1 parent 762d52c commit 6531c4f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 15 deletions.
1 change: 1 addition & 0 deletions book/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ parts:
- file: exercises/001.md
- file: exercises/002.md
- file: exercises/003.md
- file: exercises/004.md
- file: references.md
- file: changelog.md
- file: credits.md
14 changes: 8 additions & 6 deletions book/exercises/001.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@ Can you add some content to the intro page?
1. Go to the the file `book/intro.md` on your GitHub repository (`https://github.com/<your_username>/<your_repo_name>`) - {octicon}`code;1em` `Code` - `Book` - `intro.md` - {octicon}`pencil;1em` `Edit this file`
2. Add some text. Feeling brave? Have a look at the [MyST cheat sheet](https://jupyterbook.org/en/stable/reference/cheatsheet.html). Don't worry if that feels daunting, there will be exercises on this!
3. Click `Commit changes`
4. Add a message and description of your change
4. Add a message and description of your change. With this `commit` you save your changes to the git-timeline. Any commit can always be reverted. Therefore, it's useful to shortly explain what is included in your commit. Later on, you'll make commits which may contain changes to many different files. In that case, a descriptive commit message and description is even more useful!
5. Select `Commit directly to the main branch` (this adds your change your change to the default version instead of making a new one)
6. Click `Commit changes`
6. Click `Commit changes`.
7. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update intro.md / the commit messageof the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root`
8. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page (your browser keeps a cached version of website you recently visit, but we actually want the most up-to-date version!).

```{note} Check your understanding
Before moving on to the next exercise, make sure you understand the following:
1. Where are the contents of the book stored?
2. How can you edit a single file via the GitHub browser interface?
3. What is a commit and what role does it play in the editing process?
4. Given a specific GitHub repository, can you determine the URL of the book website?
- Where are the contents of the book stored?
- How can you edit a single file via the GitHub browser interface?
- What is a commit and what role does it play in the editing process?
- Given a specific GitHub repository, can you determine the URL of the book website?
- How can you view the changes you made to the book?
- What is the purpose of a commit message and description?
```
9 changes: 5 additions & 4 deletions book/exercises/002.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ parts:
14. Select `Commit directly to the main branch` (this adds your change your change to the default version instead of making a new one)
15. Click `Commit changes`
16. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update _toc.yml / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting)
17. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page (your browser keeps a cached version of website you recently visit, but we actually want the most up-to-date version!).
17. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.

```{note} Check your understanding
Before moving on to the next exercise, make sure you understand the following:
1. Are all files in the repository added to the website?
2. How many commits does it take to add a file online?
3. What needs to be on a page at least to be edit to the book?
- Are all files in the repository added to the website?
- How many commits does it take to add a file online?
- What needs to be on a page at least to be edit to the book?
- What is the purpose of the `_toc.yml` file?
```
10 changes: 5 additions & 5 deletions book/exercises/003.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ The 24th line of your `_config.yml` should look like
6. Add a message and description of your change
7. Select `Commit directly to the main branch` (this adds your change your change to the default version instead of making a new one)
8. Click `Commit changes`
9. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update _config.yml / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting)
10. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page (your browser keeps a cached version of website you recently visit, but we actually want the most up-to-date version!).
9. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update _config.yml / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root`
10. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.

```{note} Check your understanding
Before moving on to the next exercise, make sure you understand the following:
1. What is this special `_config.yml` file?
2. Changes in `_config.yml` can have effect on multiple pages in the book
3. The `_config.yml` is generally not used for adding content
- What is this special `_config.yml` file?
- Changes in `_config.yml` can have effect on multiple pages in the book
- The `_config.yml` is generally not used for adding content
```
25 changes: 25 additions & 0 deletions book/exercises/004.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Exercise 4: _Your_ Version of the Book

By now, we've covered the essentials: content files, `_toc.yml` and `_config.yml`. But what if you want to make some changes but don't want to share them directly with the general public of your book website? Or what if you have some work-in-progress that you want to share with colleagues? You need a version of your book! Let's try and do that! Later on, you'll probably want to merge your newest version back into the original book. That's what we'll do in [](./005.md).

Can you make a new `branch` of your book with an additional file `file_on_new_version.md` and view it online?

1. Add a new Issue to let people know you're working on something by going to your repository (`https://github.com/<your_username>/<your_repo_name>`) - {octicon}`issue-opened;1em` `Issues` - `New issue` (note that is not required for making your own version, but it's good practice)
2. Add a title and description, eg. `Added some content`
3. On `Assignees`, click `Assign yourself
4. Click `Submit new issue`
5. In the new window, under `Development`, click `Create a branch` (note that you could also make branches in other ways, but in this way it's directly linked to the issue). A 'branch' is a separate version of the book which keeps the link with the original book.
6. Use the default options and click `Create branch`
7. Ignore the `checkout in your local repository`- popup for now (later on you'll know what this is and how to use it)
8. Go to `Code` - {octicon}`git-branch;1em` `main` and click on `1-<your_issue_title>` to open your branch.
9. Add a book page as explained in [](./002.md) and make sure you commit to the `1-<your_issue_title>`-branch.
10. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update _toc.yml / the commit message of the commit you just made` - Wait for it to finish - In the summary, you should now see multiple Branches. Click on the link of your new branch ``1-<your_issue_title>`
11. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.

```{note} Check your understanding
Before moving on to the next exercise, make sure you understand the following:
- What is the purpose of creating a new branch in your repository?
- Why is it good practice to create an issue before starting work on a new feature or change?
- How can you view the changes made in your new branch online?
```

0 comments on commit 6531c4f

Please sign in to comment.