diff --git a/.github/workflows/call-deploy-book.yml b/.github/workflows/call-deploy-book.yml new file mode 100644 index 0000000..bec1772 --- /dev/null +++ b/.github/workflows/call-deploy-book.yml @@ -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 + diff --git a/book/external/template b/book/external/template index 0742432..7165661 160000 --- a/book/external/template +++ b/book/external/template @@ -1 +1 @@ -Subproject commit 0742432a4f3a14b3813cb697d7834b721ca7925a +Subproject commit 71656612afa24342f345d9e113553b8ff3cdf4b1 diff --git a/book/features/creating_basic_HTML_elements.md b/book/features/creating_basic_HTML_elements.md index 3d44023..806395d 100644 --- a/book/features/creating_basic_HTML_elements.md +++ b/book/features/creating_basic_HTML_elements.md @@ -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 diff --git a/book/installation-and-setup/git-setup_local.md b/book/installation-and-setup/git-setup_local.md index 8a463b3..3444fd1 100644 --- a/book/installation-and-setup/git-setup_local.md +++ b/book/installation-and-setup/git-setup_local.md @@ -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. diff --git a/book/installation-and-setup/git.md b/book/installation-and-setup/git.md index 09b93cb..e99f1f7 100644 --- a/book/installation-and-setup/git.md +++ b/book/installation-and-setup/git.md @@ -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) \ No newline at end of file diff --git a/book/installation-and-setup/overview.md b/book/installation-and-setup/overview.md index b72fd51..3db5dcc 100644 --- a/book/installation-and-setup/overview.md +++ b/book/installation-and-setup/overview.md @@ -6,7 +6,7 @@ The following table will link the relevant installation and setup steps for you. |User Types|Required actions|
Installation
| |:---:|:---|:---| -| Type 1
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
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
Git| VS Code
GitHub Desktop / Git in VS Code | -| Type 5 | Editing text
Git
Managing code-related software
Build your book | VS Code
GitHub Desktop / Git in VS Code
Anaconda
Jupyter Book | \ No newline at end of file +| Type 5 | Editing text
Git
Managing code-related software
Build your book | VS Code
GitHub Desktop / Git in VS Code
Anaconda
Jupyter Book | diff --git a/book/installation-and-setup/user_types.md b/book/installation-and-setup/user_types.md index 5d6f09c..742aa14 100644 --- a/book/installation-and-setup/user_types.md +++ b/book/installation-and-setup/user_types.md @@ -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**.
-Example Image - - 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. - -
+1. **Students providing feedback on the published website**.
Example Image 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**.
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**.
-Example Image +Example Image 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. diff --git a/book/workflows/branches.md b/book/workflows/branches.md index 1a84baa..5ecc00d 100644 --- a/book/workflows/branches.md +++ b/book/workflows/branches.md @@ -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 +
+ Example Image +
+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 ...** +
+ Example Image +
+ +3. Finally, give your branch a name and specifiy the source branch.
+Tip: It makes sense to give the branch a name related to the content you will be creating or altering. + +
+ Example Image +
+ +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). + +
+ Example Image +
+`````` +``````` +`````````` + +``````````{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`. -```` +
+ Example Image +
-````{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 -``` +
+ Example Image +
+`````` -```` -````` +``````{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". +
+ Example Image +
+ +2. Clicking on the button will display the following screen. Click on `Open with GitHub Desktop`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +2. In the top bar click on `URL`. + +
+ Example Image +
+ +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.
+Have a look at the other section!** +```````` + +````````{tab-item} Branching + +**I want to...
+(a) update my repository (pulling) and
+(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`. + +
+ Example Image +
+ +2. Clicking on `Branches` will bring you to an overview of all the branches in the repository. Click on the green `Create Branch` button. + +
+ Example Image +
+ +3. Finally, give your branch a name and specifiy the source branch.
+Tip: It makes sense to give the branch a name related to the content you will be creating or altering. + +
+ Example Image +
+ +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). + +
+ Example Image +
+ +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'. + +
+ Example Image +
+ +**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`. + +
+ Example Image +
+ +2. Clicking on `Branches` will bring you to an overview of all the branches in the repository. Click on the green `Create Branch` button. + +
+ Example Image +
+ +3. Finally, give your branch a name and specifiy the source branch.
+Tip: It makes sense to give the branch a name related to the content you will be creating or altering. + +
+ Example Image +
+ +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). + +
+ Example Image +
+ +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 `.** ```````` ````````` - -Now that we've created and checked out our new branch, we can start {ref}`making and committing changes `. +`````````` +``````````` diff --git a/book/workflows/check_changes_online.md b/book/workflows/check_changes_online.md index 72ccd51..818d4c7 100644 --- a/book/workflows/check_changes_online.md +++ b/book/workflows/check_changes_online.md @@ -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://.github.io/. + +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` + +
+ Example Image +
````` You can keep on [editing](edit_book) and checking your changes until you're satisfied and ready for a review by a colleague. \ No newline at end of file diff --git a/book/workflows/collaboration.md b/book/workflows/collaboration.md index 99b1fde..edb4d24 100644 --- a/book/workflows/collaboration.md +++ b/book/workflows/collaboration.md @@ -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
+(a) opening the repository locally (cloning) and
+(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
+(a) updating your repository (pulling) and
+(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
+(a) making changes on a single / multiple file(s),
+(b) selecting changes to be added to the Git-timeline (staging),
+(c) adding those to the Git-timeline (committing) and
+(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
+(a) regularly obtaining updates from colleagues from GitLab/GitHub (pulling),
+(b) solving potential incompatible changes (merge conflicts),
+(c) making changes on a single / multiple file(s),
+(d) selecting changes to be added to the Git-timeline (staging),
+(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
+(a) making changes on a single / multiple file(s),
+(b) checking changes locally,
+(c) selecting changes to be added to the Git-timeline (staging),
+(d) adding those to the Git-timeline (committing) and
+(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
+(a) regularly obtaining updates from colleagues from GitLab/GitHub (pulling),
+(b) solving potential incompatible changes (merge conflicts),
+(c) making changes on a single / multiple file(s),
+(d) checking changes locally,
+(e) selecting changes to be added to the Git-timeline (staging),
+(f) adding those to the Git-timeline (committing) and
+(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)** \ No newline at end of file + 7. **Publish changes to student version of the book (merge request)** diff --git a/book/workflows/edit_book.md b/book/workflows/edit_book.md index 0297226..5685760 100644 --- a/book/workflows/edit_book.md +++ b/book/workflows/edit_book.md @@ -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`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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)
+ (2) selecting changes to be added to the Git-timeline (staging)
+ (3) adding changes to the Git-timeline (committing) and
+ (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) +
+ Example Image +
-```{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 -``` +
+ Example Image +
+Alternatively, you can also click on `Push origin` in the top bar. + +
+ Example Image +
```` ````` `````` -``````{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),
+ (2) solving potential incompatible changes (merging conflicts),
+ (3) making changes on a single / multiple file(s),
+ (4) selecting changes to be added to the Git-timeline (staging),
+ (5) adding those to the Git-timeline (committing) and
+ (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? +
+ Example Image +
-```{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. -```` -````` +
+ Example Image +
+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'. + +
+ Example Image +
+ +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). + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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*. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +Alternatively, you can also click on `Push origin` in the top bar. + +
+ Example Image +
+ +```` +````` +`````` +``````` +```````` + +````````{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)
+ (2) checking changes locally,
+ (3) selecting changes to be added to the Git-timeline (staging)
+ (4) adding changes to the Git-timeline (committing) and
+ (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 +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +Alternatively, you can also click on `Push origin` in the top bar. + +
+ Example Image +
+ +```{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),
+ (2) solving potential incompatible changes (merging conflicts),
+ (3) making changes on a single / multiple file(s),
+ (4) checking changes locally,
+ (5) selecting changes to be added to the Git-timeline (staging),
+ (6) adding those to the Git-timeline (committing) and
+ (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? +
+ Example Image +
-```{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. + +
+ Example Image +
+ +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'. + +
+ Example Image +
+ +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). + +
+ Example Image +
+ +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*. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +Alternatively, you can also click on `Push origin` in the top bar. + +
+ Example Image +
```` - ````` - - `````` ``````` - - - ```````` - ````````` \ No newline at end of file diff --git a/book/workflows/figures/CheckOutBranch_GitHubDesktop.PNG b/book/workflows/figures/CheckOutBranch_GitHubDesktop.PNG new file mode 100644 index 0000000..804c5e4 Binary files /dev/null and b/book/workflows/figures/CheckOutBranch_GitHubDesktop.PNG differ diff --git a/book/workflows/figures/CheckOutBranch_GitHubDesktop2.PNG b/book/workflows/figures/CheckOutBranch_GitHubDesktop2.PNG new file mode 100644 index 0000000..29d49dc Binary files /dev/null and b/book/workflows/figures/CheckOutBranch_GitHubDesktop2.PNG differ diff --git a/book/workflows/figures/CloneGitHubDesktop.PNG b/book/workflows/figures/CloneGitHubDesktop.PNG new file mode 100644 index 0000000..6487982 Binary files /dev/null and b/book/workflows/figures/CloneGitHubDesktop.PNG differ diff --git a/book/workflows/figures/CloneRepo_Githubdesk.png b/book/workflows/figures/CloneRepo_Githubdesk.png new file mode 100644 index 0000000..2de8433 Binary files /dev/null and b/book/workflows/figures/CloneRepo_Githubdesk.png differ diff --git a/book/workflows/figures/CloneRepo_TroughGithubdesk.PNG b/book/workflows/figures/CloneRepo_TroughGithubdesk.PNG new file mode 100644 index 0000000..95a1b96 Binary files /dev/null and b/book/workflows/figures/CloneRepo_TroughGithubdesk.PNG differ diff --git a/book/workflows/figures/Clone_GitHub.PNG b/book/workflows/figures/Clone_GitHub.PNG new file mode 100644 index 0000000..16c8c0d Binary files /dev/null and b/book/workflows/figures/Clone_GitHub.PNG differ diff --git a/book/workflows/figures/Conflicts1.PNG b/book/workflows/figures/Conflicts1.PNG new file mode 100644 index 0000000..fcf7be3 Binary files /dev/null and b/book/workflows/figures/Conflicts1.PNG differ diff --git a/book/workflows/figures/Conflicts2.PNG b/book/workflows/figures/Conflicts2.PNG new file mode 100644 index 0000000..b33946c Binary files /dev/null and b/book/workflows/figures/Conflicts2.PNG differ diff --git a/book/workflows/figures/Fetch.PNG b/book/workflows/figures/Fetch.PNG new file mode 100644 index 0000000..3f0e3cc Binary files /dev/null and b/book/workflows/figures/Fetch.PNG differ diff --git a/book/workflows/figures/GitHubPages.PNG b/book/workflows/figures/GitHubPages.PNG new file mode 100644 index 0000000..84cc31f Binary files /dev/null and b/book/workflows/figures/GitHubPages.PNG differ diff --git a/book/workflows/figures/HubUser3_EditFile.PNG b/book/workflows/figures/HubUser3_EditFile.PNG new file mode 100644 index 0000000..a2db841 Binary files /dev/null and b/book/workflows/figures/HubUser3_EditFile.PNG differ diff --git a/book/workflows/figures/HubUser3_EditFile2.PNG b/book/workflows/figures/HubUser3_EditFile2.PNG new file mode 100644 index 0000000..ca472d6 Binary files /dev/null and b/book/workflows/figures/HubUser3_EditFile2.PNG differ diff --git a/book/workflows/figures/HubUser3_NewFile.PNG b/book/workflows/figures/HubUser3_NewFile.PNG new file mode 100644 index 0000000..18623e2 Binary files /dev/null and b/book/workflows/figures/HubUser3_NewFile.PNG differ diff --git a/book/workflows/figures/HubUser3_NewFile2.PNG b/book/workflows/figures/HubUser3_NewFile2.PNG new file mode 100644 index 0000000..f8dc8eb Binary files /dev/null and b/book/workflows/figures/HubUser3_NewFile2.PNG differ diff --git a/book/workflows/figures/HubUser3_toc.PNG b/book/workflows/figures/HubUser3_toc.PNG new file mode 100644 index 0000000..1c58de3 Binary files /dev/null and b/book/workflows/figures/HubUser3_toc.PNG differ diff --git a/book/workflows/figures/Issue_GitHub.PNG b/book/workflows/figures/Issue_GitHub.PNG new file mode 100644 index 0000000..035fbc5 Binary files /dev/null and b/book/workflows/figures/Issue_GitHub.PNG differ diff --git a/book/workflows/figures/Merge_Conflict_GitHubDesktop.PNG b/book/workflows/figures/Merge_Conflict_GitHubDesktop.PNG new file mode 100644 index 0000000..57f55d6 Binary files /dev/null and b/book/workflows/figures/Merge_Conflict_GitHubDesktop.PNG differ diff --git a/book/workflows/figures/Merge_Conflict_GitHubDesktop2.PNG b/book/workflows/figures/Merge_Conflict_GitHubDesktop2.PNG new file mode 100644 index 0000000..905b7e8 Binary files /dev/null and b/book/workflows/figures/Merge_Conflict_GitHubDesktop2.PNG differ diff --git a/book/workflows/figures/Merge_Conflict_GitLab.PNG b/book/workflows/figures/Merge_Conflict_GitLab.PNG new file mode 100644 index 0000000..391166d Binary files /dev/null and b/book/workflows/figures/Merge_Conflict_GitLab.PNG differ diff --git a/book/workflows/figures/NewBranch_GitHub.PNG b/book/workflows/figures/NewBranch_GitHub.PNG new file mode 100644 index 0000000..efe8bd3 Binary files /dev/null and b/book/workflows/figures/NewBranch_GitHub.PNG differ diff --git a/book/workflows/figures/NewBranch_GitHub2.PNG b/book/workflows/figures/NewBranch_GitHub2.PNG new file mode 100644 index 0000000..644e247 Binary files /dev/null and b/book/workflows/figures/NewBranch_GitHub2.PNG differ diff --git a/book/workflows/figures/NewBranch_GitHub3.PNG b/book/workflows/figures/NewBranch_GitHub3.PNG new file mode 100644 index 0000000..4c3d006 Binary files /dev/null and b/book/workflows/figures/NewBranch_GitHub3.PNG differ diff --git a/book/workflows/figures/NewBranch_GitHub4.PNG b/book/workflows/figures/NewBranch_GitHub4.PNG new file mode 100644 index 0000000..e3c9af6 Binary files /dev/null and b/book/workflows/figures/NewBranch_GitHub4.PNG differ diff --git a/book/workflows/figures/New_Issue_GitHub.PNG b/book/workflows/figures/New_Issue_GitHub.PNG new file mode 100644 index 0000000..54b9d1d Binary files /dev/null and b/book/workflows/figures/New_Issue_GitHub.PNG differ diff --git a/book/workflows/figures/New_Issue_GitHub2.PNG b/book/workflows/figures/New_Issue_GitHub2.PNG new file mode 100644 index 0000000..fc21064 Binary files /dev/null and b/book/workflows/figures/New_Issue_GitHub2.PNG differ diff --git a/book/workflows/figures/New_Issue_GitHub3.PNG b/book/workflows/figures/New_Issue_GitHub3.PNG new file mode 100644 index 0000000..9a7b974 Binary files /dev/null and b/book/workflows/figures/New_Issue_GitHub3.PNG differ diff --git a/book/workflows/figures/New_Issue_GitHub4.PNG b/book/workflows/figures/New_Issue_GitHub4.PNG new file mode 100644 index 0000000..075be4b Binary files /dev/null and b/book/workflows/figures/New_Issue_GitHub4.PNG differ diff --git a/book/workflows/figures/Pull_Request.PNG b/book/workflows/figures/Pull_Request.PNG new file mode 100644 index 0000000..096f77e Binary files /dev/null and b/book/workflows/figures/Pull_Request.PNG differ diff --git a/book/workflows/figures/Pull_Request2.PNG b/book/workflows/figures/Pull_Request2.PNG new file mode 100644 index 0000000..131e331 Binary files /dev/null and b/book/workflows/figures/Pull_Request2.PNG differ diff --git a/book/workflows/figures/Pull_Request3.PNG b/book/workflows/figures/Pull_Request3.PNG new file mode 100644 index 0000000..9094bed Binary files /dev/null and b/book/workflows/figures/Pull_Request3.PNG differ diff --git a/book/workflows/figures/Pull_Request4.PNG b/book/workflows/figures/Pull_Request4.PNG new file mode 100644 index 0000000..36a6195 Binary files /dev/null and b/book/workflows/figures/Pull_Request4.PNG differ diff --git a/book/workflows/figures/Pull_Request5.PNG b/book/workflows/figures/Pull_Request5.PNG new file mode 100644 index 0000000..765c7e9 Binary files /dev/null and b/book/workflows/figures/Pull_Request5.PNG differ diff --git a/book/workflows/figures/Pull_Request6.PNG b/book/workflows/figures/Pull_Request6.PNG new file mode 100644 index 0000000..e0a4ff7 Binary files /dev/null and b/book/workflows/figures/Pull_Request6.PNG differ diff --git a/book/workflows/figures/Pull_VS.PNG b/book/workflows/figures/Pull_VS.PNG new file mode 100644 index 0000000..0154f68 Binary files /dev/null and b/book/workflows/figures/Pull_VS.PNG differ diff --git a/book/workflows/figures/Push_GitHubDesktop.PNG b/book/workflows/figures/Push_GitHubDesktop.PNG new file mode 100644 index 0000000..0d0d072 Binary files /dev/null and b/book/workflows/figures/Push_GitHubDesktop.PNG differ diff --git a/book/workflows/figures/Push_GitHubDesktop2.PNG b/book/workflows/figures/Push_GitHubDesktop2.PNG new file mode 100644 index 0000000..fbca26f Binary files /dev/null and b/book/workflows/figures/Push_GitHubDesktop2.PNG differ diff --git a/book/workflows/figures/Solve_Conflict.PNG b/book/workflows/figures/Solve_Conflict.PNG new file mode 100644 index 0000000..c0b4fe4 Binary files /dev/null and b/book/workflows/figures/Solve_Conflict.PNG differ diff --git a/book/workflows/figures/Stage_GitHubDekstop.PNG b/book/workflows/figures/Stage_GitHubDekstop.PNG new file mode 100644 index 0000000..35d45c0 Binary files /dev/null and b/book/workflows/figures/Stage_GitHubDekstop.PNG differ diff --git a/book/workflows/figures/User3_EditFile.PNG b/book/workflows/figures/User3_EditFile.PNG new file mode 100644 index 0000000..6b140ae Binary files /dev/null and b/book/workflows/figures/User3_EditFile.PNG differ diff --git a/book/workflows/figures/User3_EditFile2.PNG b/book/workflows/figures/User3_EditFile2.PNG new file mode 100644 index 0000000..16f9dda Binary files /dev/null and b/book/workflows/figures/User3_EditFile2.PNG differ diff --git a/book/workflows/figures/User3_NewFile.PNG b/book/workflows/figures/User3_NewFile.PNG new file mode 100644 index 0000000..ecbb9e9 Binary files /dev/null and b/book/workflows/figures/User3_NewFile.PNG differ diff --git a/book/workflows/figures/User3_NewFile2.PNG b/book/workflows/figures/User3_NewFile2.PNG new file mode 100644 index 0000000..cadf097 Binary files /dev/null and b/book/workflows/figures/User3_NewFile2.PNG differ diff --git a/book/workflows/figures/User3_toc.PNG b/book/workflows/figures/User3_toc.PNG new file mode 100644 index 0000000..9481eae Binary files /dev/null and b/book/workflows/figures/User3_toc.PNG differ diff --git a/book/workflows/figures/VSCode_Pull.PNG b/book/workflows/figures/VSCode_Pull.PNG new file mode 100644 index 0000000..58c20ff Binary files /dev/null and b/book/workflows/figures/VSCode_Pull.PNG differ diff --git a/book/workflows/figures/buildbook.PNG b/book/workflows/figures/buildbook.PNG new file mode 100644 index 0000000..7d62d7a Binary files /dev/null and b/book/workflows/figures/buildbook.PNG differ diff --git a/book/workflows/merge_request.md b/book/workflows/merge_request.md index 80321f3..acf79ea 100644 --- a/book/workflows/merge_request.md +++ b/book/workflows/merge_request.md @@ -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 `. +```{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`. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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. + +
+ Example Image +
+ +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`. + +
+ Example Image +
+ +6. You can now complete the pull request by clicking `merge pull request`. + +
+ Example Image +
+```` +````{tab-item} Locally with GitHub Desktop for GitHub repositories +hi ```` - ````` diff --git a/book/workflows/milestones_issues.md b/book/workflows/milestones_issues.md index 1d8c9c5..7e848f3 100644 --- a/book/workflows/milestones_issues.md +++ b/book/workflows/milestones_issues.md @@ -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.
+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. + +
+ Example Image +
+ +Clicking on `Issues` will open up the page with all the issues on this repositery. + +
+ Example Image +
+ +Finally, by clicking the green `New Issue` button you can create a new issue and specify all the attributes we mentioned before! + +
+ Example Image +
+ +```{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. + +
+ Example Image +
+ +Clicking on `create a branch` will open the following window in which you can specify the name and the repositery. + +
+ Example Image +
```` ````` diff --git a/book/workflows/access_control_permissions.md b/book/workflows/permissions.md similarity index 100% rename from book/workflows/access_control_permissions.md rename to book/workflows/permissions.md diff --git a/book/workflows/repositories.md b/book/workflows/repositories.md new file mode 100644 index 0000000..f33d7ec --- /dev/null +++ b/book/workflows/repositories.md @@ -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 +.... +```` +````` \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 5c6680c..d42b694 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ jupyter-book +teachbooks sphinx-inline-tabs jupyterlite-sphinx