template/book/exercises/005.md
Tom van Woudenberg 262c07df11 Fix topics
2025-01-26 20:17:52 +01:00

30 lines
No EOL
3.4 KiB
Markdown

# Exercise 5: Merge your version in the original book
In [](./004.md) you created your own version of a book. But it would be a pity if you never contribute back to the original book right? Probably your additions are very useful there too! You'll merge you version of the book which is stored on a branch into the original book which is on main. If there've been some changes on that main branch in the meantime, git will take care of that!
::::::{topic} Exercise objective
Can you merge your branch into `main` with a pull request?
::::::
1. Go to your repository homepage. Probably, it will have big yellow announcement saying {octicon}`git-branch;1em` `1-<your_issue_title> had recent pushes <some> minutes ago - Compare & Pull request`. We'll ignore that for now and do it manually.
2. Go to the pull request page on your repository homepage - {octicon}`git-pull-request;1em` and click `New pull request`
3. On {octicon}`git-compare;1em` make sure you point from your branch `1-<your_issue_title>` into `main`. So, `main` on the left, {octicon}`arrow-left;1em`, and `1-<your_issue_title>` on the right. Main is the default name for the branch which has the most recent/stable version. The page should now show all the changes you made on the `1-<your_issue_title>`-branch. If there would be changes on the `main` branch in the meantime, they should show up here too.
4. Click `Create pull request` to start the process of moving your changes into the `main` branch. If there were changes on both branches which are conflicting, it will tell you there's a merge conflict. If you followed the steps until now, that shouldn't be the case. Solving those merge conflicts is topic for another exercise.
5. Add a title and description described the changes you made. This is done to give other people a summary of what has been changed.
6. Assign yourself to make clear that you feel responsible.
7. Click `Create pull request`. On the next page you'll see that GitHub gives an announcement {octicon}`bookmark;1em` `<your_username> linked an issue now that may be closed by this pull request`. That sounds useful!
8. As you're the only one in this repo there's nobody to review your work. So let's continue and merge your changes into `main` by clicking `Merge pull request` and `Confirm merge` (eventually specifying the suggested commit message and description)
9. As this issue is now closed, you can safely remove the branch `1-<your_issue_title>` as you don't need it anymore. You can do so by clicking `Delete branch`.
10. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Merge pull request #2 from <your_username>/1-<your_issue_title> / the commit message of the commit you just made` - Wait for it to finish - In the summary, click the link of the main branch or the primary book at root.
11. Do you see your change from your branch 1-<your_issue_title>? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page. Check that the url indeed shows that you're on main.
```{admonition} Check your understanding
:class: note
Before moving on to the next exercise, make sure you understand the following:
- What is the purpose of creating a pull request?
- How do you manually create a pull request on GitHub?
- Why is it important to add a title and description to your pull request?
- What is the final step after merging your pull request?
- How can you verify that your changes have been successfully merged into the main branch?
```