Merge branch 'main' into 'publish'

Colab update

See merge request interactivetextbooks-citg/jupyter-book-manual!75
This commit is contained in:
Tom van Woudenberg 2024-05-27 14:19:55 +02:00
commit b1d3ddd181
61 changed files with 1075 additions and 232 deletions

24
.github/workflows/call-deploy-book.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: call-deploy-book
on:
push:
branches:
- '**'
# If your git repository has the Jupyter Book within some-subfolder next to
# unrelated files, you can make this run only if a file within that specific
# folder (or the workflow file itself) has been modified.
#
paths:
- book/**
- .github/workflows/call-deploy-book.yml
workflow_dispatch:
jobs:
call-workflow:
uses: TeachBooks/deploy-book-workflow/.github/workflows/deploy-book.yml@main
secrets: inherit
permissions:
contents: read
pages: write
id-token: write

@ -1 +1 @@
Subproject commit 0742432a4f3a14b3813cb697d7834b721ca7925a
Subproject commit 71656612afa24342f345d9e113553b8ff3cdf4b1

View file

@ -57,7 +57,7 @@ The first few lines of our JavaScript code are simple. To scale our element with
Next, we may want to define some functions for our element. The first function `linspace` is simply creates `resolution` points between a `start` and `end` value, similar to `numpy.linspace` in Python. The second and third functions evaluate the pdf and cdf of a standard Gaussian distribution for a given `x` value.
```html
```
function linspace(start, end, resolution) {
var spacing = [];
// Go through a for-loop
@ -189,7 +189,7 @@ Now, let us add actual content. We start by creating 201 equally-spaced points o
Next, we concatenate our `x` and `pdf` vectors into a list of dictionaries, which we then convert into pixel coordinates with a `valueline_pdf` function we create. Finally, we add it to the subplot as a `path` via the `svg.append("path")` function. In addition, we want to represent the fact that the cdf (which we will later plot on the right) represents the integral of all pdf values to the left of the current x-value. To this end, we want to create a filled shape that highlights this area. We can do so by creating another path that follows the pdf from the left border to the currently selected value (initially: `x=0`), then moves back to the subplot origin along the x-axis. The path-information `data_fill` is created the same way as before, but now we add it as a `svg.append("path")` that has the `fill` attribute, which - as the name implies - fills the region inside it with a solid color.
```html
```
// Evaluate the normal pdf
var x = linspace(-3, 3, 201);
var pdf = standard_Gaussian_pdf(x);
@ -252,7 +252,7 @@ Next, we concatenate our `x` and `pdf` vectors into a list of dictionaries, whic
The next block essentially repeats the same procedure for the right subplot, but replaces the pdf evaluation with a cdf evaluation. We also add a dashed horizontal line that marks the integral value on the y-axis. Go through the code and see if you recognize parallels to the code above.
```html
```
// Define a subplot for the standard normal
const y_limits_cdf = [0, 1];
const window_x_cdf = [width * 0.585, width * 0.985];
@ -367,7 +367,7 @@ One of the nice things about these interactive JavaScript elements is that you c
Finally, we close all open environments, and are done with this simple interactive element!
```html
```
// Shift the marker around on mouseover; restrict it to the contour
var movex, movey, xpos

View file

@ -111,7 +111,7 @@ And type the following command to set the email address:
## GitHub Desktop
GitHub is a competitor company to GitLab. It provides very similar services, but they are often called different names, or have slightly different features. GitHub provides a free software that is very useful: [GitHub Desktop](https://desktop.github.com/)! While GitLab is a cloud-based version control system built around git, GitHub Desktop makes it possible to manage our git repositories locally on our computers, even though they are stored on GitLab. This is very useful for working with the jupyter-book more extensively and work on interactive features. GitHub Desktop provides an alternative to Git in VS Code, and will be described on a later stage.
GitHub is a competitor company to GitLab. It provides very similar services, but they are often called different names, or have slightly different features. GitHub provides a free software that is very useful: [GitHub Desktop](https://desktop.github.com/)! While GitLab is a cloud-based version control system built around Git, GitHub Desktop makes it possible to manage our Git repositories locally on our computers, even though they are stored on GitLab. This is very useful for working with the jupyter-book more extensively and work on interactive features. GitHub Desktop provides an alternative to Git in VS Code, and will be described on a later stage.
## Terminology
This is a (non-exhaustive) list of terminology that will be used in Git for local use.

View file

@ -5,7 +5,7 @@
This page is useful for user type 3-5.
```
You'll need to interact with Git to collaborate on TeachBooks, but what is that thing?
You'll need to interact with Git to collaborate on TeachBooks, but what is this thing?
## What is Git?
@ -13,11 +13,11 @@ Git is a version control system (VCS), used by a wide variety of engineers and s
### What is GitLab?
GitLab is a cloud-based version control system built around git. It provides a lot more features such as Issues, Merge Requests, CI/CD pipelines, etc. TU Delft has a license to use GitLab on our own local webservers—this means that all of the files are stored digitally on the TU Delft campus, rather than some unkown webserver that could be physically located in an unsafe location. This is also why we have our “own” GitLab located at gitlab.tudelft.nl, rather than the “normal” GitLab at gitlab.com.
GitLab is a cloud-based version control system built around Git. It provides a lot more features such as Issues, Merge Requests, CI/CD pipelines, etc. TU Delft has a license to use GitLab on our own local webservers—this means that all of the files are stored digitally on the TU Delft campus, rather than some unkown webserver that could be physically located in an unsafe location. This is also why we have our “own” GitLab located at gitlab.tudelft.nl, rather than the “normal” GitLab at gitlab.com.
### What is GitHub?
GitHub is the same service as GitLab, but it's part of a commercial company (Microsoft). It's the most well-known cloud-based git provider and provides a lot of functionalities for free for education. It also allows you to host websites on `github.io` eliminating the need for your own / TU Delft webserver, although you don't have full servercontrol.
GitHub is the same service as GitLab, but it's part of a commercial company (Microsoft). It's the most well-known cloud-based Git provider and provides a lot of functionalities for free for education. It also allows you to host websites on `github.io` eliminating the need for your own / TU Delft webserver, although you don't have full servercontrol.
### Additional lessons
Software carpentry offers git-lessons if you'd like to learn more than just it's specific use for TeachBooks. The lessons are available [online](https://swcarpentry.github.io/git-novice/) and TU Delft offers these as part of a [Software Carpentry workshop](https://www.tudelft.nl/library/research-data-management/r/training-evenementen/training-voor-onderzoekers/software-carpentry-workshops)

View file

@ -6,7 +6,7 @@ The following table will link the relevant installation and setup steps for you.
|User Types|Required actions|<div style="width:200px">Installation</div>|
|:---:|:---|:---|
| Type 1<br>Type 2 | Review book | No software needed! Just open your interactive book online and give review in the way you're asked to do|
| Type 1<br>Type 2 | Review book | No software needed! Just open your interactive book online and give a review in the way you're asked to |
| Type 3 | Edit single files online | No software needed! But you'll interact with Git, which might be a new thing for you |
| Type 4 | Editing text<br>Git| VS Code<br>GitHub Desktop / Git in VS Code |
| Type 5 | Editing text<br>Git<br>Managing code-related software<br>Build your book | VS Code<br>GitHub Desktop / Git in VS Code<br>Anaconda<br>Jupyter Book |
| Type 5 | Editing text<br>Git<br>Managing code-related software<br>Build your book | VS Code<br>GitHub Desktop / Git in VS Code<br>Anaconda<br>Jupyter Book |

View file

@ -2,14 +2,7 @@
Different types of users will interact with the website or the Jupyter Books differently and will therefore need to know more or less about the composition of the book. For now we will differentiate 6 types of users.
1. **Students providing feedback on the published website**. <br>
<img src="figures/type 1.jpg" alt="Example Image" align="left" width="120" style="margin: 10px;">
There are multiple tools of providing feedback in the build book:
- Using the [hypothesis](https://jupyterbook.org/en/stable/interactive/comments/hypothesis.html)-extension which allows public/private highlighting and annotating parts of the book. An example can be seen on the [MUDE website](https://mude.citg.tudelft.nl/book/intro.html)
- Using the [Utterances](https://jupyterbook.org/en/stable/interactive/comments/utterances.html)-extension which allows commenting on pages for books which are hosted on GitHub. Those comments are converted to issues on GitHub for the editors to handle.
<br style="clear:both;">
1. **Students providing feedback on the published website**.<br> <img src="figures/type 1.jpg" alt="Example Image" align="right" width="130" style="margin: 10px;"> There are multiple tools of providing feedback in the built book: a) Using the [hypothesis](https://jupyterbook.org/en/stable/interactive/comments/hypothesis.html)-extension which allows public/private highlighting and annotating parts of the book. An example can be seen on the [MUDE website](https://mude.citg.tudelft.nl/book/intro.html). b) Using the [Utterances](https://jupyterbook.org/en/stable/interactive/comments/utterances.html)-extension which allows commenting on pages for books which are hosted on GitHub. Those comments are converted to issues on GitHub for the editors to handle.
2. **Colleague providing feedback on the draft website**. <br>
In a similar manner as students, colleages and team members can leave content related comments on the website through extensions. In this way, multiple teachers can give input in the draft of the textbook and course material without requiring and exact understanding of Jupyter Books or GitLab/GitHub. The responsible teacher (or student assistants) can then make the adaptations to the book as recommended by their colleagues.
@ -21,7 +14,7 @@ Different types of users will interact with the website or the Jupyter Books dif
User 4 is a hybrid between type 3 and 5. Basically this user is making changes by editing the .md files locally using, for example, VS Code. Therefore, this user requires a little bit more knowledge on git (think of pulling and pushing changes) but their main focus remains to make adjustments to the content of the book by editing .md files whereas user type 4 has more knowledge to make changes to python files the book as well. This user can build the book online.
5. **Colleague making text and code (especially Python) adjustments to multiple files at the same time locally**. <br>
<img src="figures/type 5.jpg" alt="Example Image" align="left" width="120" style="margin: 10px;">
<img src="figures/type 5.jpg" alt="Example Image" align="right" width="120" style="margin: 10px;">
This user has more knowledge in GitLab/GitHub than the previous user and can basically take care of branching and merging by themselves. They know how to work with software for editing .md and .ipynb files. They can use the draft book online to view their changed in the book, or build the book locally.

View file

@ -9,16 +9,19 @@ This systematic workflow guarantees that editing the book goes smoothly.
The act of making a new branch from an existing one is called *branching*. Usually, you want to branch from the `main` branch, but you can of course also choose to branch from another branch. The branch from which you create a new branch is called the *source* branch.
**Create your own version by ...**
**Create your own version as ...**
`````````{tab-set}
````````{tab-item} ... user type 3
```````````{tab-set}
**... by directly creating your own version (branching) or selecting existing version in ...**
``````````{tab-item} ... user type 3 ...
`````{tab-set}
````{tab-item} ... GitLab
1. On GitLab, navigate to the repository of your project. Under the project description, you should see a menu button with a "+" in it (see {numref}`new-branch-button`). Click this button, then click on "New branch".
**... by directly creating your own version of the book (branching) or selecting an existing version in ...**
```````{tab-set}
``````{tab-item} ... GitLab
1. Navigate to the repository of your project. Under the project description, you should see a menu button with a "+" in it (see {numref}`new-branch-button`). Click this button, then click on "New branch".
```{figure} ../images/gitlab-branch.png
:name: new-branch-button
@ -34,65 +37,121 @@ Click the highlighted button to make a new branch.
We're making a new branch called `chapter-2` from the `main` branch.
```
3. You should be sent back to an overview page of your repository. In the branch selection menu (see {numref}`new-branch-repo`), it should now say `chapter-2` instead of `main`. Here you can also select another existing branch.
3. You should be sent back to an overview page of your repository. In the branch selection menu (see {numref}`new-branch-repo`), it should now say `chapter-2` instead of `main`. Here you can also select another existing branch which is what we previously called `selecting an existing version`.
```{figure} ../images/gitlab-new-branch-repo.png
:name: new-branch-repo
The circled menu is the branch selection menu.
```
``````
````
````{tab-item} ... GitHub
``````{tab-item} ... GitHub
```{error} To be written
```
````
`````
````````
1. Open the repository in which you want to work in. In the top bar you will see your current branch `main` and next to that there is a tab called `Branches`.
````````{tab-item} ... user type 4 and 5
<figure align="center">
<img src="figures/NewBranch_GitHub.PNG" alt="Example Image" width="650">
</figure>
2. Clicking on `Branches` will bring you to an overview of all the branches in the repository. Click on the green `Create Branch` button.
**... for ...**
<figure align="center">
<img src="figures/NewBranch_GitHub2.PNG" alt="Example Image" width="650">
</figure>
3. Finally, give your branch a name and specifiy the source branch. <br>
Tip: It makes sense to give the branch a name related to the content you will be creating or altering.
<figure align="center">
<img src="figures/NewBranch_GitHub3.PNG" alt="Example Image" width="350">
</figure>
4. You will find your new branch in the drop down menu as seen on the figure below. You can then select your new branch and start working in it (new version) but you can also work in any other branch if you are helping out a colleague with their chapter for example (existing version).
<figure align="center">
<img src="figures/NewBranch_GitHub4.PNG" alt="Example Image" width="650">
</figure>
``````
```````
``````````
``````````{tab-item} ... user type 4 and 5 ...
As user type 4 and 5, you make changes to the book locally on your computer rather than online on GitLab/GitHub. This allows you to create more complex and interactive sections to your book. Before you can start, there are a few preparatory steps you need to take.
**Cloning**
In order to create your own version, you will first have to open the repositery. Then, you will need to clone the repositery to your computer. This procedure is called cloning.
**Branching**
If your repositery is already cloned on your computer, you are almost ready to start editing the book. However, remember that you are most likely not the only person making changes to the book. To keep an overview of the changes made by you and your colleages, it is important that changes are first made in a 'copy' of the book and are then merged into the final version. This is done through branching! You can create your version of the book by creating a new version (branch) or you can continue the work in an existing version (checkout branch).
`````````{tab-set}
````````{tab-item} Cloning
**1. Open the repository locally using ...**
```````{tab-set}
``````{tab-item} ... repository opened for first time
**... by opening the repository locally (cloning) and creating your own version (branching) or select existing version (checkout branch) from ...**
``````{tab-item} ... GitLab
`````{tab-set}
````{tab-item} ... GitLab
1. On GitLab, go to the repository of your book. Click on the blue button that says "Clone" ({numref}`gitlab-clone`), and copy the link under "Clone with SSH".
1. Navigate to the repository of your book. Click on the blue button that says "Clone" ({numref}`gitlab-clone`), and copy the link under "Clone with SSH".
```{figure} ../images/gitlab-clone.png
:name: gitlab-clone
The cloning menu.
```
````
``````
````{tab-item} ... GitHub
``````{tab-item} ... GitHub
```{error} To be written
```
1. Open the repository that you would like to clone. In the top bar on the right, you will a green button called `<> Code`.
````
<figure align="center">
<img src="figures/NewBranch_GitHub.PNG" alt="Example Image" width="650">
</figure>
````{tab-item} ... GitHub using GitHub Desktop
2. Clicking on the button will display the following screen. Make sure the option `SSH` is selected and copy the link.
```{error} To be written
```
<figure align="center">
<img src="figures/Clone_GitHub.PNG" alt="Example Image" width="400">
</figure>
``````
````
`````
``````{tab-item} ... GitHub through GitHub Desktop
**... with ...**
1. Open the repository that you would like to clone. In the top bar on the right, you will a green button called `<> Code`.
`````{tab-set}
````{tab-item} ... Git in VS Code
2. Open a new VS Code window. You should be greeted with a welcome page ({numref}`vscode-welcome`). On this page, click "Clone Git Repository". Alternatively, open the Source Control menu from the left side bar, and click on "Clone Repository".
<figure align="center">
<img src="figures/NewBranch_GitHub.PNG" alt="Example Image" width="650">
</figure>
2. Clicking on the button will display the following screen. Click on `Open with GitHub Desktop`.
<figure align="center">
<img src="figures/Clone_GitHub.PNG" alt="Example Image" width="400">
</figure>
3. The Browser should then automatically open GitHub Desktop. Customize the path to the location where you would like to save to files locally. Finally, click on `Clone`.
<figure align="center">
<img src="figures/CloneRepo_TroughGithubdesk.PNG" alt="Example Image" width="400">
</figure>
You have now directly cloned the repository, so you can skip the next step!
``````
```````
**2. Clone the local repositery with ...**
```````{tab-set}
``````{tab-item} ... VS Code
1. Open a new VS Code window. You should be greeted with a welcome page ({numref}`vscode-welcome`). On this page, click "Clone Git Repository". Alternatively, open the Source Control menu from the left side bar, and click on "Clone Repository".
```{figure} ../images/vscode-welcome.png
:name: vscode-welcome
@ -100,11 +159,130 @@ The cloning menu.
The VS Code welcome screen.
```
3. On the top of your screen, you should get a prompt asking you for a URL. In this field, paste the link you copied from GitLab and press enter. It will ask you to choose the location of the repository. After you've chosen a location, a final prompt will show up asking if you want to open the repository. Click on "Open".
2. On the top of your screen, you should get a prompt asking you for a URL. In this field, paste the link you copied from GitLab and press enter. It will ask you to choose the location of the repository. After you've chosen a location, a final prompt will show up asking if you want to open the repository. Click on "Open".
3. You now have a local copy of the repository.
``````
``````{tab-item} ... GitHub Desktop
1. You have previously copied the link of the repositery you would like to clone from GitLab or GitHub. In GitHub Desktop, navigate to the top bar, click on `File` and then on `Clone repositery`.
<figure align="center">
<img src="figures/CloneRepo_Githubdesk.PNG" alt="Example Image" width="350">
</figure>
2. In the top bar click on `URL`.
<figure align="center">
<img src="figures/CloneRepo_TroughGithubdesk.PNG" alt="Example Image" width="400">
</figure>
3. Simply paste the link, specify the working directory (location where you would like to save the folder locally) and click on 'Clone'.
4. You now have a local copy of the repository.
5. The final step is to *check out* our new branch in VS Code. *Checking out* means that we're changing our working branch (i.e., the one to which we will be committing our changes) from one to the other. In VS Code, open the branch menu from the bottom left (see {numref}`git-branch-menu-main`). You'll be be greeted with a menu that looks like the one in {numref}`git-branch-selection-menu`. In this menu, we get an overview of the branches of our repository. Notice that our new branch `chapter-2` appears as `origin/chapter-2`, and has a cloud icon in front of it. This means that the branch only exists on the remote repository. Check out the branch by simply clicking on it. Check that the branch is indeed checked out by looking at the branch menu button in the bottom left again; it should now say the name of your branch instead of `main` (in our case `chapter-2`).
``````
```````
**You have now cloned the repositery to your computer and you can start branching. <br>
Have a look at the other section!**
````````
````````{tab-item} Branching
**I want to... <br>
(a) update my repository (pulling) and <br>
(b) create my own version (branching) or select an existing version (checkout branch) using ...**
```````{tab-set}
``````{tab-item} ... Git in VS Code
**1. Update your repositery**
Since you are working in a repositery with multiple colleagues, it is good practice to make sure your local repositery is up to date before you start branching. This is especially important when you want to work in an existing branch. In that case you want to make sure that the existing branch shows in your local repositery. Therefore, you first need to pull all the changes from the remote repositery to your local repositery. Simply click the Icon with the two arrows.
```{figure} ../figures/Pull_VS.PNG
:name: Pull_VS
Location of the branch menu.
```
Once your local repositery is up to date you can start to work either in a new branch (new version) or in an existing branch (exisiting version).
**2. Create your own version by creating a new branch**
Although it is possible to create new branches in VS Code directly, creating new branches on the remote repositery (on GitLab or GitHub) is better for collaborating because the new branch becomes immediately visible to everyone working in the repositery as opposed to becoming visible after being pushed to the remote repositery.
Create a new branch in...
`````{tab-set}
````{tab-item} ... GitLab
1. Navigate to the repository of your project. Under the project description, you should see a menu button with a "+" in it (see {numref}`new-branch-button`). Click this button, then click on "New branch".
```{figure} ../images/gitlab-branch.png
:name: new-branch-button
Click the highlighted button to make a new branch.
```
2. A new page opens ({numref}`new-branch-menu`), on which you can specify the name of your branch and the source branch. Try to think of a good name for your branch. For example, `chapter-2` is a suitable name if we're going to be working on Chapter 2 of our book. After you've made sure that the selected source branch is correct, click "Create branch".
```{figure} ../images/gitlab-branch-name.png
:name: new-branch-menu
We're making a new branch called `chapter-2` from the `main` branch.
```
3. You should be sent back to an overview page of your repository. In the branch selection menu (see {numref}`new-branch-repo`), it should now say `chapter-2` instead of `main`.
```{figure} ../images/gitlab-new-branch-repo.png
:name: new-branch-repo
The circled menu is the branch selection menu.
```
You have now created a new branch on the remote, make sure to fetch & pull again to see it on the local repositery!
````
````{tab-item} ... GitHub
1. Open the repository in which you want to work in. In the top bar you will see your current branch `main` and next to that there is a tab called `Branches`.
<figure align="center">
<img src="figures/NewBranch_GitHub.PNG" alt="Example Image" width="650">
</figure>
2. Clicking on `Branches` will bring you to an overview of all the branches in the repository. Click on the green `Create Branch` button.
<figure align="center">
<img src="figures/NewBranch_GitHub2.PNG" alt="Example Image" width="650">
</figure>
3. Finally, give your branch a name and specifiy the source branch. <br>
Tip: It makes sense to give the branch a name related to the content you will be creating or altering.
<figure align="center">
<img src="figures/NewBranch_GitHub3.PNG" alt="Example Image" width="350">
</figure>
4. You will find your new branch in the drop down menu as seen on the figure below. You can then select your new branch and start working in it (new version).
<figure align="center">
<img src="figures/NewBranch_GitHub4.PNG" alt="Example Image" width="650">
</figure>
5. jupYou have now created a new branch on the remote, make sure to fetch & pull again to see it on the local repositery!
````
`````
**3. Work in an existing branch**
If you want to work in an existing branch you need to *check out* our new branch in VS Code. *Checking out* means that we're changing our working branch (i.e., the one to which we will be committing our changes) from one to the other.
In VS Code, open the branch menu from the bottom left (see {numref}`git-branch-menu-main`). You'll be be greeted with a menu that looks like the one in {numref}`git-branch-selection-menu`. In this menu, we get an overview of the branches of our repository. Notice that our new branch `chapter-2` appears as `origin/chapter-2`, and has a cloud icon in front of it. This means that the branch only exists on the remote repository.
Check out the branch by simply clicking on it. Check that the branch is indeed checked out by looking at the branch menu button in the bottom left again; it should now say the name of your branch instead of `main` (in our case `chapter-2`).
```{figure} ../images/git-branch-menu-main.png
:name: git-branch-menu-main
@ -115,43 +293,108 @@ Location of the branch menu.
:name: git-branch-selection-menu
The branch selection menu, where our new branch has shown up. From this menu you can also select (checkout in git terms) another existing branch.
````
````{tab-item} ... GitHub Desktop
```{error} To be written
```
````
`````
``````
``````{tab-item} ... GitHub Desktop
``````{tab-item} ... previously opened repository
**1. Update your repositery**
**by updating your repository (pulling) and creating your own version (branching) or select existing version (checkout branch) with ...**
Since you are working in a repositery with multiple colleagues, it is good practice to make sure your local repositery is up to date before you start branching. This is especially important when you want to work in an existing branch. In that case you want to make sure that the existing branch shows in your local repositery. Therefore, you first need to pull all the changes from the remote repositery to your local repositery.
This synchronizes the remote repositery with your local repositery on your computer. Click on `Fetch` in the top bar. Then on the same place, click on 'Pull'.
<figure align="center">
<img src="figures/Fetch.PNG" alt="Example Image" width="650">
</figure>
**2. Create your own version by creating a new branch.**
Although it is possible to create new branches in GitHub Desktop directly, creating new branches on the remote repositery (on GitLab or GitHub) is better for collaborating because the new branch becomes immediately visible to everyone working in the repositery as opposed to becoming visible after being pushed to the remote repositery.
Create a new branch in...
`````{tab-set}
````{tab-item} ... Git in VS Code
````{tab-item} ... GitLab
```{error} To be written
1. Navigate to the repository of your project. Under the project description, you should see a menu button with a "+" in it (see {numref}`new-branch-button`). Click this button, then click on "New branch".
```{figure} ../images/gitlab-branch.png
:name: new-branch-button
Click the highlighted button to make a new branch.
```
2. A new page opens ({numref}`new-branch-menu`), on which you can specify the name of your branch and the source branch. Try to think of a good name for your branch. For example, `chapter-2` is a suitable name if we're going to be working on Chapter 2 of our book. After you've made sure that the selected source branch is correct, click "Create branch".
```{figure} ../images/gitlab-branch-name.png
:name: new-branch-menu
We're making a new branch called `chapter-2` from the `main` branch.
```
3. You should be sent back to an overview page of your repository. In the branch selection menu (see {numref}`new-branch-repo`), it should now say `chapter-2` instead of `main`.
```{figure} ../images/gitlab-new-branch-repo.png
:name: new-branch-repo
The circled menu is the branch selection menu.
```
You have now created a new branch on the remote, make sure to fetch & pull again to see it on the local repositery!
````
````{tab-item} ... GitHub Desktop
```{error} To be written
```
````{tab-item} ... GitHub
1. Open the repository in which you want to work in. In the top bar you will see your current branch `main` and next to that there is a tab called `Branches`.
<figure align="center">
<img src="figures/NewBranch_GitHub.PNG" alt="Example Image" width="650">
</figure>
2. Clicking on `Branches` will bring you to an overview of all the branches in the repository. Click on the green `Create Branch` button.
<figure align="center">
<img src="figures/NewBranch_GitHub2.PNG" alt="Example Image" width="650">
</figure>
3. Finally, give your branch a name and specifiy the source branch. <br>
Tip: It makes sense to give the branch a name related to the content you will be creating or altering.
<figure align="center">
<img src="figures/NewBranch_GitHub3.PNG" alt="Example Image" width="350">
</figure>
4. You will find your new branch in the drop down menu as seen on the figure below. You can then select your new branch and start working in it (new version).
<figure align="center">
<img src="figures/NewBranch_GitHub4.PNG" alt="Example Image" width="650">
</figure>
5. You have now created a new branch on the remote, make sure to fetch & pull again to see it on the local repositery!
````
`````
**3. Work in an existing branch**
The next step is to *check out* our new branch in GitHub Desktop. *Checking out* means that we're changing our working branch (i.e., the one to which we will be committing our changes) from one to the other.
In GitHub Desktop, the top bar has a menu called `Current Branch`. By clicking on it you can see all the branches you created on the remote repositery.
```{figure} ../figures/CheckOutBranch_GitHubDesktop.PNG
```
2. Check out the branch by simply clicking on it. The following window will pop up.
```{figure} ../figures/CheckOutBranch_GitHubDesktop2.PNG
```
Leave your changes (stashed) on your working branch, in this case I was working in the branch called `collaboration git`.
3. Check that the branch is indeed checked out by looking at the branch menu at the the top left again; the current branch should say the name.
``````
```````
**Now that you have created and checked out your new branch, you can start {ref}`making and committing changes <stage-commit-push>`.**
````````
`````````
Now that we've created and checked out our new branch, we can start {ref}`making and committing changes <stage-commit-push>`.
``````````
```````````

View file

@ -1,17 +1,36 @@
# Check changes online
```{Note}
This page is relevant for user type 4 and 5. When making changes to the book it can be useful to get an idea on how they will be realized in the online book. Whereas user type 5 can also build the book locally, user type 4 is more focused on the changes to the content.
However both users would certainly benefit from checking whether their changes look good in the book!
```
Now that you've pushed your changes online, it's time to check the change in the online build book to make sure that your changes are processed correctly. For this step it is assumed you're using TeachBook's GitHub actions or TeachBook's GitLab pipeline.
`````{tab-set}
````{tab-item} In GitLab
At the moment this is not possible, but the workflow will soon be the same as for GitHub.
````
````{tab-item} In GitHub
- Wait for the action to finish
- Visit the website of your build book
```{error} To be written
```
1. Enable GitHub Pages on your repositery. Note that if you use the Teachbooks template this is probably already done!
2. Once your book files are pushed to your GitHub repository you can view the book. Make sure you wait for the action to finish (GitHub Desktop shows progress if its part of a pull request, VS Code shows progress with the GitHub Actions addon).
3. Viewing the Book: Once GitHub Pages is enabled and your book is published, you can view it by visiting the GitHub Pages URL for your repository. The URL will typically be in the format https://<username>.github.io/<repository-name>.
Alternatively you can find it in the settings
- Go to your GitHub repository's settings.
- Scroll down to the "GitHub Pages" section (left side-bar: pages)
- Copy the link or click on `Visit site`
<figure align="center">
<img src="figures/GitHubPages.PNG" alt="Example Image" width="650">
</figure>
`````
You can keep on [editing](edit_book) and checking your changes until you're satisfied and ready for a review by a colleague.

View file

@ -5,54 +5,80 @@
This page is useful for user type 3, 4 and 5.
```
A jupyter book is composed out of many files which contain the educational content produced by you. Through the use of branches it is possible to work on the book at the same time as your team-members. Working on content for the book is mainly individual work, the beauty of git comes in when everybody's changes are merged into the main branch.
A jupyter book is composed out of many files which contain the educational content produced by you. Through the use of branches it is possible to work on the book at the same time as your team-members. Working on content for the book is mainly individual work, the beauty of Git comes in when everybody's changes are merged into the main branch.
We have previously introduced the notions of using Git in the online environment (remote) or locally. All the (text, figures, etc.) files that make up the book are contained on the remote repository on GitLab or GitHub. This could be on an open repository on `gitlab.com` or `github.com`. In the context of creating educational books for students at TU Delft, the repository will most likely be located on `gitlab.tudelft.nl` or `github.com/teachbooks`.
The steps involved are as follows:
1. **Assign task to yourself (milestones, issues)**
2. **Create your own version of the book by**
1. **Assign a task to yourself (milestones, issues)**
2. **Create your own version of the book as...**
```````{tab-set}
``````{tab-item} ... user type 3
**... by directly creating your own version (branching) or selecting existing version:**
``````{tab-item} ... user type 3...
**... by creating your own version of the book (branching) or selecting existing version:**
- branching
``````
``````{tab-item} ... user type 4 and 5
**... for ...**
`````{tab-set}
````{tab-item} ... repository opened for first time
**... by opening the repository locally (cloning) and creating your own version (branching) or select existing version (checkout branch):**
````{tab-item} Open repository for first time...
**... by <br>
(a) opening the repository locally (cloning) and <br>
(b) creating your own version (branching) or selecting existing version (checkout branch):**
- cloning
- branching / checkout branch
````
````{tab-item} ... previously opened repository
**... by updating your repository (pulling) and creating your own version (branching) or select existing version (checkout branch):**
````{tab-item} Work in previously opened repository...
**... by <br>
(a) updating your repository (pulling) and <br>
(b) creating your own version (branching) or select existing version (checkout branch):**
- pulling
- branching / checkout branch
````
`````
``````
```````
3. **Edit the book by ...**
3. **Edit the book as ...**
```````{tab-set}
``````{tab-item} ... user type 3
``````{tab-item} ... user type... 3
**... by directly adding changes on a single file to Git-timeline (committing):**
- adding or making changes to single file
- adding file or making changes to single file
- committing
``````
``````{tab-item} ... user type 4
... on ...
``````{tab-item} ... user type 4...
`````{tab-set}
````{tab-item} ... brand new version (branch)
**... by making changes on a single / multiple file(s), selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing):**
````{tab-item} ... on a brand new version (branch)...
**... by <br>
(a) making changes on a single / multiple file(s), <br>
(b) selecting changes to be added to the Git-timeline (staging), <br>
(c) adding those to the Git-timeline (committing) and <br>
(d) adding those changes to GitLab/GitHub (pushing):**
- adding or making changes to file(s)
- staging
- committing
- pushing
````
````{tab-item} ... existing version (branch)
**... by regularly obtaining updates from colleagues from GitLab/GitHub (pulling), solving potential incompatible changes (merge conflicts), making changes on a single / multiple file(s), selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing):**
````{tab-item} ... on an existing version (branch)...
**... by <br>
(a) regularly obtaining updates from colleagues from GitLab/GitHub (pulling), <br>
(b) solving potential incompatible changes (merge conflicts), <br>
(c) making changes on a single / multiple file(s), <br>
(d) selecting changes to be added to the Git-timeline (staging), <br>
(e) adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing):**
- pulling
- solving merge conflicts
- adding or making changes to file(s)
@ -62,19 +88,34 @@ The steps involved are as follows:
````
`````
``````
``````{tab-item} ... user type 5
... on ...
``````{tab-item} ... user type 5...
`````{tab-set}
````{tab-item} ... brand new version (branch)
**... by making changes on a single / multiple file(s), checking changes locally, selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing):**
````{tab-item} ... on a brand new version (branch)...
**... by <br>
(a) making changes on a single / multiple file(s), <br>
(b) checking changes locally, <br>
(c) selecting changes to be added to the Git-timeline (staging), <br>
(d) adding those to the Git-timeline (committing) and <br>
(e) adding those changes to GitLab/GitHub (pushing):**
- adding or making changes to file(s)
- checking changes locally
- staging
- committing
- pushing
````
````{tab-item} ... existing version (branch)
**... by regularly obtaining updates from colleagues from GitLab/GitHub (pulling), solving potential incompatible changes (merge conflicts), making changes on a single / multiple file(s), checking changes locally, selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing):**
````{tab-item} ... on an existing version (branch)...
**... by <br>
(a) regularly obtaining updates from colleagues from GitLab/GitHub (pulling), <br>
(b) solving potential incompatible changes (merge conflicts), <br>
(c) making changes on a single / multiple file(s), <br>
(d) checking changes locally, <br>
(e) selecting changes to be added to the Git-timeline (staging), <br>
(f) adding those to the Git-timeline (committing) and <br>
(g) adding those changes to GitLab/GitHub (pushing):**
- pulling
- solving merge conflicts
- adding or making changes to file(s)
@ -83,10 +124,9 @@ The steps involved are as follows:
- committing
- pushing
````
``````
```````
4. **Check changes online**
4. **Check candles nline**
5. **Repeat steps 3 and 4 until you're satisfied**
6. **Reviewing (merge request), (eventually repeat steps 3 and 4) and combine (merging) your version with main draft version of book**
7. **Publish changes to student version of the book (merge request)**
7. **Publish changes to student version of the book (merge request)**

View file

@ -2,56 +2,107 @@
Suppose we are writing a new chapter, or are updating an existing chapter for our Jupyter Book. We've created a new branch on which we are going to make the changes.
**Edit files by ...**
**Edit files as ...**
`````````{tab-set}
````````{tab-item} ... user type 3
**... by directly adding changes on a single file to Git-timeline (committing) in ...**
````````{tab-item} ... user type 3 ...
**... by directly adding changes on a single file to the Git-timeline (committing) in ...**
`````{tab-set}
````{tab-item} ... GitLab
Make changes to file in text editor...
or add new file by text or upload
In GitLab, you can directly make changes in the files on the remote repositery. You can make changes to the files already in the repositery using the text editor but you can also upload new files!
```{error} To be written
```
1. Navigate to the repositery you want to work in.
click commit in single text editor ...
```{error} To be written
```
2. Create a new file by clicking on the plus button in the top bar. You can either create an entirely new file by clicking `New File` or if you already have created a file you can upload it by clicking `Upload File`.
<figure align="center">
<img src="figures/User3_NewFile.PNG" alt="Example Image" width="500">
</figure>
3. In the new window, you can start typing your content. Give your file a name and make sure to use the markdown extension: `Chapter1.md`. Once you are done, commit the new file to the repositery by clicking the blue button `Commit changes`.
<figure align="center">
<img src="figures/User3_NewFile2.PNG" alt="Example Image" width="700">
</figure>
4. In case you want to make changes to an existing file, navigate to the file in your remote repositery. Then click the blue button called `Edit` and select the option `Edit single file`.
<figure align="center">
<img src="figures/User3_EditFile.PNG" alt="Example Image" width="700">
</figure>
5. Make your changes in the text editor and when you are ready, commit your changes to the remote repositery by clicking on the blue `Commit changes` button.
<figure align="center">
<img src="figures/User3_EditFile2.PNG" alt="Example Image" width="700">
</figure>
6. In case you added a new file, you also need to include it table of contents of your book! The table of contents is specified in a file called `toc.yml` and it is already included in your repositery if you used the teachbooks template.
<figure align="center">
<img src="figures/User3_toc.PNG" alt="Example Image" width="500">
</figure>
You can edit it and commit the changes in the same manner as with markdown (.md) files.
````
````{tab-item} ... GitHub
Make changes to file in text editor...
or add new file by text or upload
In GitHub, you can directly make changes in the files on the remote repositery. You can make changes to the files already in the repositery using the text editor but you can also upload new files!
```{error} To be written
```
1. Navigate to the repositery you want to work in.
click commit in single text editor ...
```{error} To be written
```
2. Create a new file by clicking on the button called `Add file` in the top bar. You can either create an entirely new file by clicking `Create new File` or if you already have created a file you can upload it by clicking `Upload files`.
<figure align="center">
<img src="figures/HubUser3_NewFile.PNG" alt="Example Image" width="500">
</figure>
3. In the new window, you can start typing your content. Give your file a name and make sure to use the markdown extension: `Chapter1.md`. Once you are done, commit the new file to the repositery by clicking the green button `Commit changes`.
<figure align="center">
<img src="figures/HubUser3_NewFile2.PNG" alt="Example Image" width="700">
</figure>
4. In case you want to make changes to an existing file, navigate to the file in your remote repositery. Then click the downward pointing arrow on the very left in the top bar. Select the option `Edit in place`.
<figure align="center">
<img src="figures/HubUser3_EditFile.PNG" alt="Example Image" width="700">
</figure>
5. Make your changes in the text editor and when you are ready, commit your changes to the remote repositery by clicking on the green `Commit changes` button.
<figure align="center">
<img src="figures/HubUser3_EditFile2.PNG" alt="Example Image" width="700">
</figure>
6. In case you added a new file, you also need to include it table of contents of your book! The table of contents is specified in a file called `toc.yml` and it is already included in your repositery if you used the teachbooks template.
<figure align="center">
<img src="figures/HubUser3_toc.PNG" alt="Example Image" width="500">
</figure>
You can edit it and commit the changes in the same manner as with markdown (.md) files.
````
`````
````````
````````{tab-item} ... user type 4
````````{tab-item} ... user type 4 ...
**... for ...**
```````{tab-set}
``````{tab-item} ... brand new version (branch)
``````{tab-item} ... for a brand new version (branch)...
**... by making changes on a single / multiple file(s), selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing) with ...**
**... by (1) making changes on a single or multiple file(s) <br>
(2) selecting changes to be added to the Git-timeline (staging) <br>
(3) adding changes to the Git-timeline (committing) and <br>
(4) adding changes to GitLab/GitHub (pushing) with ...**
`````{tab-set}
````{tab-item} ... Git in VS Code
1. Make some changes to a file in for example VS Code and save them.
```{error} To be written
```
Make some changes in for example VS Code and save them.
Select files ready to be added to Git-timeline (staging)
2. Select the files ready to be added to Git-timeline (staging)
For demonstration purposes, we have created a new Markdown file called `new-chapter.md`, which we want to add to the book. Since this is a new file, Git has no knowledge about its existence yet. I.e., the file is *untracked*. To add new files to our repository, we need to *stage* and *commit* them. To do this, open the Source Control menu in the left side bar. Our new file should appear in this menu:
@ -62,17 +113,17 @@ The new file appears in the Source Control menu.
Notice that there is a green letter U placed besides the file, meaning that our file is untracked. To add a file to the *staging area*, click on the + that appears when you hover over the file.
3. Adding changes to the Git-timeline (committing)
Next, in the field that says "Message", write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, the menu should now look something like this:
```{figure} ../images/git-file-added.png
The new file has been staged, and we've written a Commit Message.
```
Now, we are ready to add the changes to the repository. This is done by *committing* the staged changes. To do this, simply press the big, blue "Commit" button in the Source Control menu.
In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab.
4. In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab.
```{figure} ../images/git-push.png
@ -81,78 +132,68 @@ After committing, click the 🔄 button to push our changes to the remote reposi
````
````{tab-item} ... GitHub Desktop
```{error} To be written
```
Make some changes in for example VS Code and save them.
1. Make some changes to a file in for example VS Code and save them.
The staging GitHub Desktop assumes you want to stage all files. You can unselect some of them (unstaging them)...
```{error} To be written
```
2. The staging GitHub Desktop assumes you want to stage all files. These files will show up on the left side bar when you open GitHub Desktop. You can unselect some of them (unstaging them) by clicking on the *check*.
Add changes to Git-timeline locally (committing)
<figure align="center">
<img src="figures/Stage_GitHubDekstop.PNG" alt="Example Image" width="400">
</figure>
```{error} To be written
```
3. Add changes to Git-timeline locally (committing). In the field that says `Summary(Required)`, write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, click the blue button `Commit to Repositery`.
Add changes to GitHub/GitLab (pushing)
4. Now we need to add changes to GitHub/GitLab. This is called pushing to the local repositery. After committing, the following screen will pop up. Click on `Push Origin`.
```{error} To be written
```
<figure align="center">
<img src="figures/Push_GitHubDesktop.PNG" alt="Example Image" width="650">
</figure>
Alternatively, you can also click on `Push origin` in the top bar.
<figure align="center">
<img src="figures/Push_GitHubDesktop2.PNG" alt="Example Image" width="650">
</figure>
````
`````
``````
``````{tab-item} ... existing version (branch)
``````{tab-item} ... for an existing version (branch)...
**... by regularly obtaining updates from colleagues from GitLab/GitHub (pulling), solving potential incompatible changes (merge conflicts), making changes on a single / multiple file(s), selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing) with ...**
**... by (1) regularly obtaining updates from colleagues from GitLab/GitHub (pulling), <br>
(2) solving potential incompatible changes (merging conflicts), <br>
(3) making changes on a single / multiple file(s), <br>
(4) selecting changes to be added to the Git-timeline (staging), <br>
(5) adding those to the Git-timeline (committing) and <br>
(6) adding changes to GitLab/GitHub (pushing) with ...**
`````{tab-set}
````{tab-item} ... Git in VS Code
**Eventually solve conflicts with combining versions (merge conflicts, emerges after pulling)**
1. If you collaborate with colleagues on your branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. This synchronizes the remote repositery with your local repositery on your machine. On the left side-bar click on the icon that looks like a branch.
If you collaborate with colleagues on this branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. Now your branch is up-to-date. However, this might lead into a merge conflict if you and colleagues have made incompatible changes. How to solve that?
<figure align="center">
<img src="figures/VSCode_Pull.PNG" alt="Example Image" width="400">
</figure>
```{error} To be written
```
````
````{tab-item} ... GitHub Desktop
By clicking on the 🔄 button, you will pull your colleages' changes.
text..
```{error} To be written
```
2. When multiple people work on one chapter, it is possible that conflicts will arise if you and your colleagues have made incompatible changes in the same branch. In that case, when pulling from the remote repositery, Git in VS Code will recognize conflicts and help you to solve potential incompatible changes (merging conflicts). Open the files that are marked as conflicitng.
````
`````
<figure align="center">
<img src="figures/Conflicts2.PNG" alt="Example Image" width="650">
</figure>
The figure above shows the conflicts. If you look closely you can see that the last couple of words of the paragraph are different in the main branch than in the branch we were working in. There are a couple of options in the top bar:
``````
```````
- `Accept Current Change` will keep the change in your branch
- `Accept Incoming Change` will keep the change from the main branch (the branch you are merging into your branch)
- `Accept Both Changes` will retain both paragraphs
````````
Choose one of the options to resolve the merge conflict. You now have updated your work with work from your colleagues and resolved potential conlicts. You are now ready to continue working on the content.
````````{tab-item} User type 5
3. Make some further changes to a file in for example VS Code and save them.
```````{tab-set}
``````{tab-item} ... brand new version (branch)
**... by making changes on a single / multiple file(s), checking changes locally, selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing) with ...**
`````{tab-set}
````{tab-item} ... Git in VS Code
```{error} To be written
```
Make some changes in for example VS Code and save them.
build book locally and eventually startup python server...
```{error} To be written
```
Select files ready to be added to Git-timeline (staging)
4. Select the files ready to be added to Git-timeline (staging)
For demonstration purposes, we have created a new Markdown file called `new-chapter.md`, which we want to add to the book. Since this is a new file, Git has no knowledge about its existence yet. I.e., the file is *untracked*. To add new files to our repository, we need to *stage* and *commit* them. To do this, open the Source Control menu in the left side bar. Our new file should appear in this menu:
@ -163,76 +204,385 @@ The new file appears in the Source Control menu.
Notice that there is a green letter U placed besides the file, meaning that our file is untracked. To add a file to the *staging area*, click on the + that appears when you hover over the file.
5. Adding changes to the Git-timeline (committing)
Next, in the field that says "Message", write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, the menu should now look something like this:
```{figure} ../images/git-file-added.png
The new file has been staged, and we've written a Commit Message.
```
Now, we are ready to add the changes to the repository. This is done by *committing* the staged changes. To do this, simply press the big, blue "Commit" button in the Source Control menu.
In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab.
6. In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab.
```{figure} ../images/git-push.png
After committing, click the 🔄 button to push our changes to the remote repository.
````
````{tab-item} ... GitHub Desktop
1. If you collaborate with colleagues on your branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. This synchronizes the remote repositery with your local repositery on your machine. Click on `Fetch` in the top bar. Then on the same place, click on 'Pull'.
<figure align="center">
<img src="figures/Fetch.PNG" alt="Example Image" width="650">
</figure>
2. When multiple people work on one chapter, it is possible that conflicts will arise if you and your colleagues have made incompatible changes in the same branch. In that case, when pulling from the remote repositery, GitHub Desktop will recognize conflicts and help you to solve potential incompatible changes (merging conflicts).
<figure align="center">
<img src="figures/Conflicts1.PNG" alt="Example Image" width="650">
</figure>
In this case there are two conflicted files. GitHub Desktop is suggesting to resolve the changes in VS Code (in that case have a look at the section treating VS Code). By clicking on the small downwards arrow you can also solve the conflict directly in GitHub Desktop by choosing the branch of the file you want to keep.
<figure align="center">
<img src="figures/Conflicts2.PNG" alt="Example Image" width="650">
</figure>
The figure above shows the conflicts. If you look closely you can see that the last couple of words of the paragraph are different in the main branch than in the branch we were working in. There are a couple of options in the top bar:
- `Accept Current Change` will keep the change in your branch
- `Accept Incoming Change` will keep the change from the main branch (the branch you are merging into your branch)
- `Accept Both Changes` will retain both paragraphs
Choose one of the options to resolve the merge conflict. You now have updated your work with work from your colleagues and resolved potential conlicts. You are now ready to continue working on the content.
3. Make some further changes to a file in for example VS Code and save them.
4. The staging GitHub Desktop assumes you want to stage all files. These files will show up on the left side bar when you open GitHub Desktop. You can unselect some of them (unstaging them) by clicking on the *check*.
<figure align="center">
<img src="figures/Stage_GitHubDekstop.PNG" alt="Example Image" width="400">
</figure>
5. Add changes to Git-timeline locally (committing). In the field that says `Summary(Required)`, write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, click the blue button `Commit to Repositery`.
6. Now we need to add changes to GitHub/GitLab. This is called pushing to the local repositery. After committing, the following screen will pop up. Click on `Push Origin`.
<figure align="center">
<img src="figures/Push_GitHubDesktop.PNG" alt="Example Image" width="650">
</figure>
Alternatively, you can also click on `Push origin` in the top bar.
<figure align="center">
<img src="figures/Push_GitHubDesktop2.PNG" alt="Example Image" width="650">
</figure>
````
`````
``````
```````
````````
````````{tab-item} ... user type 5 ...
```````{tab-set}
``````{tab-item} ... for brand new version (branch)
**... by (1) making changes on a single or multiple file(s) <br>
(2) checking changes locally, <br>
(3) selecting changes to be added to the Git-timeline (staging) <br>
(4) adding changes to the Git-timeline (committing) and <br>
(5) adding changes to GitLab/GitHub (pushing) with ...**
`````{tab-set}
````{tab-item} ... Git in VS Code
1. Make some changes to a file in for example VS Code and save them.
2. Once all the changes are made, it can be useful to check the changes locally on your device in order to see how it will look on the website. If all the required environments and packages are downloaded, checking changes locally is fairly easy!
Navigate to the terminal in VS code, located at the bottom of the window or by clicking on `Terminal` in the top bar.
You will firstly need to actiavte the right environment. Type the following command:
`conda activate jupyter-book-env`
(or the environment in which you have installed the TeachBooks package)
Then we can build the book locally. Make sure you are in the right repositery in VS code and type the folloing command:
`jupyter-book build book`
Where book is the name of the folder containing all the files that make up your book. After `jupyter-book` is done running you will get the following:
```{figure} ../figures/buildbook.PNG
Output.
```
Paste the last line into your browser to see the updated changes.
```{Note}
Sometimes there are problems building the book. It could be that the building requires extensions that are not present in your environment. To prevent issues, make sure to update your environment by routinely updating your packages. You can do this by executing the following line in your environment in the command line.
`pip install -r requirements.txt --upgrade`
```
3. If you are satisfied with your changes, you can select the files ready to be added to Git-timeline (staging)
For demonstration purposes, we have created a new Markdown file called `new-chapter.md`, which we want to add to the book. Since this is a new file, Git has no knowledge about its existence yet. I.e., the file is *untracked*. To add new files to our repository, we need to *stage* and *commit* them. To do this, open the Source Control menu in the left side bar. Our new file should appear in this menu:
```{figure} ../images/git-new-file.png
The new file appears in the Source Control menu.
```
Notice that there is a green letter U placed besides the file, meaning that our file is untracked. To add a file to the *staging area*, click on the + that appears when you hover over the file.
4. Adding changes to the Git-timeline (committing)
Next, in the field that says "Message", write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, the menu should now look something like this:
```{figure} ../images/git-file-added.png
The new file has been staged, and we've written a Commit Message.
```
Now, we are ready to add the changes to the repository. This is done by *committing* the staged changes. To do this, simply press the big, blue "Commit" button in the Source Control menu.
5. Adding changes to GitLab/GitHub (pushing)
In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab/GitHub.
```{figure} ../images/git-push.png
After committing, click the 🔄 button to push our changes to the remote repository.
```{Note}
Missing from this chapter: startup python server.
You can read more about it [here](/book/installation-and-setup/jupyter-book-setup.md)
```
````
````{tab-item} ... GitHub Desktop
```{error} To be written
1.. Make some changes to a file in for example VS Code and save them.
2. Once all the changes are made, it can be useful to check the changes locally on your device in order to see how it will look on the website. If all the required environments and packages are downloaded, checking changes locally is fairly easy!
Navigate to the terminal in VS code, located at the bottom of the window or by clicking on `Terminal` in the top bar.
You will firstly need to actiavte the right environment. Type the following command:
`conda activate jupyter-book-env`
(or the environment in which you have installed the TeachBooks package)
Then we can build the book locally. Make sure you are in the right repositery in VS code and type the folloing command:
`jupyter-book build book`
Where book is the name of the folder containing all the files that make up your book. After `jupyter-book` is done running you will get the following:
```{figure} ../figures/buildbook.PNG
Output.
```
Make some changes in for example VS Code and save them.
Paste the last line into your browser to see the updated changes.
```{Note}
Sometimes there are problems building the book. It could be that the building requires extensions that are not present in your environment. To prevent issues, make sure to update your environment by routinely updating your packages. You can do this by executing the following line in your environment in the command line.
`pip install -r requirements.txt --upgrade`
The staging GitHub Desktop assumes you want to stage all files. You can unselect some of them (unstaging them)...
```{error} To be written
```
3. If you are satisfied with your changes, you can select the files ready to be added to Git-timeline (staging)
Add changes to Git-timeline locally (committing)
The staging GitHub Desktop assumes you want to stage all files. These files will show up on the left side bar when you open GitHub Desktop. You can unselect some of them (unstaging them) by clicking on the *check*.
```{error} To be written
<figure align="center">
<img src="figures/Stage_GitHubDekstop.PNG" alt="Example Image" width="400">
</figure>
4. Add changes to Git-timeline locally (committing). In the field that says `Summary(Required)`, write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, click the blue button `Commit to Repositery`.
5. Now we need to add changes to GitHub/GitLab. This is called pushing to the local repositery. After committing, the following screen will pop up. Click on `Push Origin`.
<figure align="center">
<img src="figures/Push_GitHubDesktop.PNG" alt="Example Image" width="650">
</figure>
Alternatively, you can also click on `Push origin` in the top bar.
<figure align="center">
<img src="figures/Push_GitHubDesktop2.PNG" alt="Example Image" width="650">
</figure>
```{Note}
Missing from this chapter: startup python server.
You can read more about it [here](/book/installation-and-setup/jupyter-book-setup.html#view-the-book-using-a-local-webserver)
```
Add changes to GitHub/GitLab (pushing)
```{error} To be written
```
````
`````
``````
``````{tab-item} ... existing version (branch)
``````{tab-item} ... for an existing version (branch)
**... by regularly obtaining updates from colleagues from GitLab/GitHub (pulling), solving potential incompatible changes (merge conflicts), making changes on a single / multiple file(s), checking changes locally, selecting changes to be added to the Git-timeline (staging), adding those to the Git-timeline (committing) and adding those changes to GitLab/GitHub (pushing) with ...**
**... by (1) regularly obtaining updates from colleagues from GitLab/GitHub (pulling), <br>
(2) solving potential incompatible changes (merging conflicts), <br>
(3) making changes on a single / multiple file(s), <br>
(4) checking changes locally, <br>
(5) selecting changes to be added to the Git-timeline (staging), <br>
(6) adding those to the Git-timeline (committing) and <br>
(7) adding changes to GitLab/GitHub (pushing) with ...**
`````{tab-set}
````{tab-item} ... Git in VS Code
**Eventually solve conflicts with combining versions (merge conflicts, emerges after pulling)**
1. If you collaborate with colleagues on your branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. This synchronizes the remote repositery with your local repositery on your machine. On the left side-bar click on the icon that looks like a branch.
If you collaborate with colleagues on this branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. Now your branch is up-to-date. However, this might lead into a merge conflict if you and colleagues have made incompatible changes. How to solve that?
<figure align="center">
<img src="figures/VSCode_Pull.PNG" alt="Example Image" width="400">
</figure>
```{error} To be written
By clicking on the 🔄 button, you will pull your colleages' changes.
2. When multiple people work on one chapter, it is possible that conflicts will arise if you and your colleagues have made incompatible changes in the same branch. In that case, when pulling from the remote repositery, Git in VS Code will recognize conflicts and help you to solve potential incompatible changes (merging conflicts). Open the files that are marked as conflicitng.
<figure align="center">
<img src="figures/Conflicts2.PNG" alt="Example Image" width="600">
</figure>
The figure above shows the conflicts. If you look closely you can see that the last couple of words of the paragraph are different in the main branch than in the branch we were working in. There are a couple of options in the top bar:
- `Accept Current Change` will keep the change in your branch
- `Accept Incoming Change` will keep the change from the main branch (the branch you are merging into your branch)
- `Accept Both Changes` will retain both paragraphs
Choose one of the options to resolve the merge conflict. You now have updated your work with work from your colleagues and resolved potential conlicts. You are now ready to continue working on the content.
3. Make some further changes to a file in for example VS Code and save them.
4. Once all the changes are made, it can be useful to check the changes locally on your device in order to see how it will look on the website. If all the required environments and packages are downloaded, checking changes locally is fairly easy!
Navigate to the terminal in VS code, located at the bottom of the window or by clicking on `Terminal` in the top bar.
You will firstly need to actiavte the right environment. Type the following command:
`conda activate jupyter-book-env`
(or the environment in which you have installed the TeachBooks package)
Then we can build the book locally. Make sure you are in the right repositery in VS code and type the folloing command:
`jupyter-book build book`
Where book is the name of the folder containing all the files that make up your book. After `jupyter-book` is done running you will get the following:
```{figure} ../figures/buildbook.PNG
Output.
```
Paste the last line into your browser to see the updated changes.
```{Note}
Sometimes there are problems building the book. It could be that the building requires extensions that are not present in your environment. To prevent issues, make sure to update your environment by routinely updating your packages. You can do this by executing the following line in your environment in the command line.
`pip install -r requirements.txt --upgrade`
```
5. Select the files ready to be added to Git-timeline (staging)
For demonstration purposes, we have created a new Markdown file called `new-chapter.md`, which we want to add to the book. Since this is a new file, Git has no knowledge about its existence yet. I.e., the file is *untracked*. To add new files to our repository, we need to *stage* and *commit* them. To do this, open the Source Control menu in the left side bar. Our new file should appear in this menu:
```{figure} ../images/git-new-file.png
The new file appears in the Source Control menu.
```
Notice that there is a green letter U placed besides the file, meaning that our file is untracked. To add a file to the *staging area*, click on the + that appears when you hover over the file.
6. Adding changes to the Git-timeline (committing)
Next, in the field that says "Message", write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, the menu should now look something like this:
```{figure} ../images/git-file-added.png
The new file has been staged, and we've written a Commit Message.
```
Now, we are ready to add the changes to the repository. This is done by *committing* the staged changes. To do this, simply press the big, blue "Commit" button in the Source Control menu.
7. In the bottom left corner, next to the branch name, click the "Synchronize Changes" button (the one that looks like this: 🔄, highlighted in the image below) to push the changes to GitLab.
```{figure} ../images/git-push.png
After committing, click the 🔄 button to push our changes to the remote repository.
````
````{tab-item} ... GitHub Desktop
text..
```{error} To be written
1. If you collaborate with colleagues on your branch, you can get the updates from your colleagues as well by pulling from GitLab/GitHub. This synchronizes the remote repositery with your local repositery on your machine. Click on `Fetch` in the top bar. Then on the same place, click on 'Pull'.
<figure align="center">
<img src="figures/Fetch.PNG" alt="Example Image" width="650">
</figure>
2. When multiple people work on one chapter, it is possible that conflicts will arise if you and your colleagues have made incompatible changes in the same branch. In that case, when pulling from the remote repositery, GitHub Desktop will recognize conflicts and help you to solve potential incompatible changes (merging conflicts).
<figure align="center">
<img src="figures/Merge_Conflict_GitHubDesktop2.PNG" alt="Example Image" width="400">
</figure>
In this case there are two conflicted files. GitHub Desktop is suggesting to resolve the changes in VS Code (in that case have a look at the section treating VS Code). By clicking on the small downwards arrow you can also solve the conflict directly in GitHub Desktop by choosing the branch of the file you want to keep.
Choose one of the options to resolve the merge conflict. You now have updated your work with work from your colleagues and resolved potential conlicts. You are now ready to continue working on the content.
3. Make some further changes to a file in for example VS Code and save them.
4. Once all the changes are made, it can be useful to check the changes locally on your device in order to see how it will look on the website. If all the required environments and packages are downloaded, checking changes locally is fairly easy!
Navigate to the terminal in VS code, located at the bottom of the window or by clicking on `Terminal` in the top bar.
You will firstly need to actiavte the right environment. Type the following command:
`conda activate jupyter-book-env`
(or the environment in which you have installed the TeachBooks package)
Then we can build the book locally. Make sure you are in the right repositery in VS code and type the folloing command:
`jupyter-book build book`
Where book is the name of the folder containing all the files that make up your book. After `jupyter-book` is done running you will get the following:
```{figure} ../figures/buildbook.PNG
Output.
```
Paste the last line into your browser to see the updated changes.
```{Note}
Sometimes there are problems building the book. It could be that the building requires extensions that are not present in your environment. To prevent issues, make sure to update your environment by routinely updating your packages. You can do this by executing the following line in your environment in the command line.
`pip install -r requirements.txt --upgrade`
```
5. The staging GitHub Desktop assumes you want to stage all files. These files will show up on the left side bar when you open GitHub Desktop. You can unselect some of them (unstaging them) by clicking on the *check*.
<figure align="center">
<img src="figures/Stage_GitHubDekstop.PNG" alt="Example Image" width="400">
</figure>
6. Add changes to Git-timeline locally (committing). In the field that says `Summary(Required)`, write a short description of the changes you have made. This message is what is called the *Commit Message*. After we've done this, click the blue button `Commit to Repositery`.
7. Now we need to add changes to GitHub/GitLab. This is called pushing to the local repositery. After committing, the following screen will pop up. Click on `Push Origin`.
<figure align="center">
<img src="figures/Push_GitHubDesktop.PNG" alt="Example Image" width="650">
</figure>
Alternatively, you can also click on `Push origin` in the top bar.
<figure align="center">
<img src="figures/Push_GitHubDesktop2.PNG" alt="Example Image" width="650">
</figure>
````
`````
``````
```````
````````
`````````

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -30,23 +30,85 @@ Creating a new merge request to merge `chapter-2` into `main`.
Example of a filled-in merge request.
```
5. After clicking `create merge request` you should land on the following page. Here, you can track the merge request. Right after your request, GitLab will do some checks to see if you've tried to merge conflicting files. As you can see in the figure below the merge is blocked due to the conflicts. Click on 'Resolve conflicts`.
5. On the page of our merge request ({numref}`gitlab-finished-merge-request`), we're greeted with some more information. On top, you can read the description we just provided when creating the merge request. We can also see an "Approve" button, which you may or may not see, depending on your repository rights. Next, we can see a green checkmark, with a "Merge" button. This is good news: our changes do not conflict with existing files on the `main` branch, and we can merge our changes directly by clicking the button (if applicable: only after somebody else approved the request). If this isn't the case, you'll see a red cross instead of the green checkmark, and GitLab will tell that you've run into a *merge conflict*. You'll need to figure out which file(s) are causing this, and fix it. You can read more on this in the {ref}`section on merge conflicts <merge-conflicts>`.
```{figure} ../figures/Merge_Request_GitLab.PNG
:name: gitlab-merge-request-conflict
Example of a blocked merge.
```
```{figure} ../images/gitlab-finished-merge-request.png
Clicking on 'Resolve conflicts`, will open the conflicted files in the text editor. There you can manually edit the files to the version you would like to retain. By clicking on `use ours` or `use theirs` you can select which version you would like to keep.
```{figure} ../figures/Solve_Conflict.PNG
:name: gitlab-conflict
Solving the conflict.
```
Once you are done, click on `Commit to source branch`. Do this for all conflicted files. Note that if your branches do not have conflicting changes you can merge directly and skip this step. In that case you can skip ahead to the next step.
In case you have cloned the repositery you can also resolve the conflicts locally using VS Code for example. You can read more about for [GitHub Dekstop](edit_book.md#... GitHub Desktop) or [VS Code](edit_book.md#... VS Code)
6. On the page of our merge request ({numref}`gitlab-finished-merge-request`), we're greeted with some more information. On top, you can read the description we just provided when creating the merge request. We can also see an "Approve" button, which you may or may not see, depending on your repository rights. Next, we can see a green checkmark, with a "Merge" button. This is good news: our changes do not conflict with existing files on the `main` branch, and we can merge our changes directly by clicking the button (if applicable: only after somebody else approved the request).
```{figure} ../../images/gitlab-finished-merge-request.png
:name: gitlab-finished-merge-request
The finished merge request.
```
````
````{tab-item} In GitHub
```{error} To be written
```
1. Make sure that you've committed all your new sections and changes, and that they're pushed to the remote repository.
2. In GitHub, navigate to the repositery you want to work in. In the top bar click `Pull Requests`. Then, in the new window click on `New Pull Request`.
<figure align="center">
<img src="figures/Pull_Request.PNG" alt="Example Image" width="650">
</figure>
3. You can now choose a base branch and a compare branch.
- Base Branch: The base branch is the branch into which you want to merge your changes.
- Compare Branch: The compare branch, also known as the "head" branch, is the branch that contains the changes you want to merge into the base branch.
<figure align="center">
<img src="figures/Pull_Request2.PNG" alt="Example Image" width="650">
</figure>
In the figure, you can see that we want to merge our changes from the branch `merge_conflict` *into* `main`, `merge_conflict` is the compare branch and `main` is the base branch. Note that in the figure it says that the branches cannot be automatically merged. The reason for this is that there are conflicts in the two branches, which you can see when scrollong down.
You can still create the pull request but you will have to manage the conflicts. Once you've selected the correct branches, click `View Pull Request`.
4. As previously mentioned, before merging the two branches we have to resolve the conflicts. Click on 'Resolve conflicts`. Note that if your branches do not have conflicting changes you can merge directly and skip this step.
<figure align="center">
<img src="figures/Pull_Request3.PNG" alt="Example Image" width="650">
</figure>
Clicking on 'Resolve conflicts`, will open the conflicted files in the text editor. There you can manually edit the files to the version you would like to retain.
<figure align="center">
<img src="figures/Pull_Request4.PNG" alt="Example Image" width="650">
</figure>
Once you are done, click on `mark as resolved` in the top right of the window. Do this for all conflicted files.
In case you have cloned the repositery you can also resolve the conflicts locally using VS Code for example. You can read more about it [here](edit_book.md#... GitHub Desktop)
5. Commit the changes by clicking on `Commit merge`.
<figure align="center">
<img src="figures/Pull_Request5.PNG" alt="Example Image" width="650">
</figure>
6. You can now complete the pull request by clicking `merge pull request`.
<figure align="center">
<img src="figures/Pull_Request6.PNG" alt="Example Image" width="650">
</figure>
````
````{tab-item} Locally with GitHub Desktop for GitHub repositories
hi
````
`````

View file

@ -16,11 +16,12 @@ Every team member can create issues when they think of a task that would improve
`````{tab-set}
````{tab-item} ... GitLab
The issues in GitLab can be found on this page:
The issues in GitLab can be found in your repositery in the left bar.
![issues](figures/issues_new.png)
You can create an issue by clicking on the blue `New Issue` button in the top right corner.
You can create an issue by clicking on the blue `New Issue` button in the top right corner. <br>
This will lead you to this window where you can specify all attributes we mentioned before!
![new issue](figures/New_Issue_GitLab.png)
@ -28,9 +29,40 @@ You can create an issue by clicking on the blue `New Issue` button in the top ri
````{tab-item} ... GitHub
```{error} To be written
```
The issues in GitHub can be found in your repositery in the top bar.
<figure align="center">
<img src="figures/Issue_GitHub.PNG" alt="Example Image" width="650">
</figure>
Clicking on `Issues` will open up the page with all the issues on this repositery.
<figure align="center">
<img src="figures/New_Issue_GitHub.PNG" alt="Example Image" width="650">
</figure>
Finally, by clicking the green `New Issue` button you can create a new issue and specify all the attributes we mentioned before!
<figure align="center">
<img src="figures/New_Issue_GitHub2.PNG" alt="Example Image" width="650">
</figure>
```{Note}
The follwing steps explain how to create a branch from a new issue. By doing this you can create most of the steps described in the section called [branching](branches.md). However, if you are unfamiliar with the term make sure to still read the section to understand the function.
```
After creating the issue, the description of the issue will automatically open. On the bottom left there is an option `create a branch` (in yellow) from this issue. This will create a new branch in the repositery which you can use to solve the issue.
<figure align="center">
<img src="figures/New_Issue_GitHub3.PNG" alt="Example Image" width="650">
</figure>
Clicking on `create a branch` will open the following window in which you can specify the name and the repositery.
<figure align="center">
<img src="figures/New_Issue_GitHub4.PNG" alt="Example Image" width="350">
</figure>
````
`````

View file

@ -0,0 +1,79 @@
# Open files online / clone files
We have previously introduced the notions of using Git in the online environment (remote) or locally. All the (markdown) files that make up the book are contained on the remote repository on GitLab or GitHub. This could be on an open repository on `gitlab.com` or `github.com`. In the context of creating educational books for students at TU Delft, the repository will most likely be located on `gitlab.tudelft.nl`.
If you'd like to work on your book locally (on your device, perhaps using Jupyter Lab or VS Code), you need to clone your repositery from the remote to your device. In familiar words, this means you need to make a copy of your book on your laptop.
### Cloning a repository
You can clone a repositery from GitLab and GitHub using GitHub Desktop or you can clone it with Git in VS Code.
`````{tab-set}
````{tab-item} Clone from GitLab using GitHub Desktop
1. On GitLab, go to the repository of your book. Click on the blue button that says "Clone" or "Code", and copy the link under "Clone with SSH".
```{figure} ../images/gitlab-clone.png
:name: gitlab-clone
The cloning menu.
```
2. Navigate to GitHub Desktop (which you've previously installed using [this tutorial](/book/installation-and-setup/git-setup_local.md)).
3. Click on `File` in the top menu.
4. Click on `Clone Repositery`. You should see the following window appear.
```{figure} ../figures/CloneGitHubDesktop.png
:name: CloneGitHubDesktop
Cloning in GitHub Desktop.
```
5. Paste the link you've just copied and define the location on your device.
````
````{tab-item} Clone from GitLab using GitHub Desktop
1. On GitLab, go to the repository of your book. Click on the blue button that says "Clone" ({numref}`gitlab-clone`), and copy the link under "Clone with SSH".
```{figure} ../images/gitlab-clone.png
:name: gitlab-clone
The cloning menu.
```
2. Navigate to GitHub Desktop (which you've previously installed using [this tutorial](/book/installation-and-setup/git-setup_local.md)).
3. Click on `File` in the top menu.
4. Click on `Clone Repositery`. You should see the following window appear.
```{figure} ../figures/CloneGitHubDesktop.png
:name: CloneGitHubDesktop
Cloning in GitHub Desktop.
```
5. Paste the link you've just copied and define the location on your device.
````
````{tab-item} Cloning repository with Git in VS Code
...
````
`````
Now that we've obtained the source, we can set up the files locally:
`````{tab-set}
````{tab-item} Cloning repository with Git in VS Code
2. Open a new VS Code window. You should be greeted with a welcome page ({numref}`vscode-welcome`). On this page, click "Clone Git Repository". Alternatively, open the Source Control menu from the left side bar, and click on "Clone Repository".
```{figure} ../images/vscode-welcome.png
:name: vscode-welcome
The VS Code welcome screen.
```
3. On the top of your screen, you should get a prompt asking you for a URL. In this field, paste the link you copied from GitLab and press enter. It will ask you to choose the location of the repository. After you've chosen a location, a final prompt will show up asking if you want to open the repository. Click on "Open".
4. You now have a local copy of the repository.
````
````{tab-item} Cloning repository with GitHub Desktop
....
````
`````

View file

@ -1,4 +1,5 @@
jupyter-book
teachbooks
sphinx-inline-tabs
jupyterlite-sphinx