Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs: 📝 add code along on renaming, editing, and moving files to working-with-files #66

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
251bee1
docs: :memo: add naming practices and looking at history to learning …
signekb Feb 26, 2025
1716936
docs: :memo: remove learning outcome
signekb Feb 26, 2025
a8d3243
docs: :memo: add overview of what we'll do during this session
signekb Feb 26, 2025
0b858db
docs: :memo: add introductory sentence to reading task
signekb Feb 26, 2025
6769eaf
docs: :memo: add callout note on what an `.md` file is
signekb Feb 26, 2025
9535809
style: :art: format section
signekb Feb 26, 2025
d20f20e
docs: :memo: add code along that adds a soup recipe to the repo
signekb Feb 26, 2025
a315de2
docs: :pencil2: change "first" to "second recipe" in cookie recipe ex…
signekb Feb 26, 2025
aec2540
docs: :memo: add code along on renaming, editing, and moving the soup…
signekb Feb 26, 2025
6741a17
docs: :pencil2: change learning objective order to match order in ses…
signekb Feb 26, 2025
f9def4c
docs: :pencil2: remove "tomato" from L1 of soup recipe so we can add …
signekb Feb 26, 2025
14b8016
docs: :pencil2: add "edit" to callout tip
signekb Feb 26, 2025
1258f04
docs: :pencil2: change "you" to "we" in code along
signekb Feb 26, 2025
c1bd374
Merge branch 'main' into docs/add-code-along-on-renaming-editing-and-…
signekb Feb 27, 2025
b1b416e
Merge branch 'main' into docs/add-code-along-on-renaming-editing-and-…
lwjohnst86 Mar 7, 2025
9a7e933
docs: :pencil2: apply suggestions from code review
signekb Mar 7, 2025
db4b6e0
chore: :wrench: add `_variables.yml` with a `github-commit` variable
signekb Mar 7, 2025
d2e1f6a
docs: :memo: use `github-commit` variable and add callout tips on wha…
signekb Mar 7, 2025
0fe6d8c
docs: :memo: change to callout-not to avoid having too many tips in a…
signekb Mar 7, 2025
37277b2
docs: :memo: add "something like" in case they didn't use that exact …
signekb Mar 7, 2025
d6bf976
docs: :pencil2: move todo into a comment that won't be shown on the w…
signekb Mar 7, 2025
5f8f514
style: :art: format text
signekb Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/_working-with-files-objectives.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- Interact with and navigate GitHub to create, edit, rename, and
- Interact with and navigate GitHub to create, rename, edit, and
delete files and folders.
- Use good naming practices for files and folders.
- Use the GitHub history page to explore and find previous changes made to your files.
80 changes: 80 additions & 0 deletions sessions/working-with-files.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,86 @@ repository! :tada:

{{< text_snippet sticky_up >}}

## Rename, edit, and move the soup recipe to a new folder

Now that we have added a couple of recipes to the repository, we'll
take a look at how to rename, edit, and move files in repositories on
GitHub.

Let's imagine that we want to add more recipes to the repository in
the future. To keep things organised, we want our recipes to have
descriptive names and content. We also want to create some folders to
group similar recipes together.

Let's start by doing this with the soup recipe we added earlier.

### Rename `soup.md`

Let's start by renaming the `soup.md` file. We'll to the `soup.md` file in
the repository by clicking on it in the "Code" tab. Then, we'll click the
pencil icon on the top-right side of the page to edit the file.

On the top-left side of the page, we'll see the name of the file. Let's click
on the name and rename the file to `tomato-soup.md`. Remember to keep
the `.md` file extension.

Once we have renamed the file, let's click the green "Commit changes" button
and commit the changes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Once we have renamed the file, let's click the green "Commit changes" button
and commit the changes.
Once we have renamed the file, click the "Commit changes" button on the right side of the page. When the commit message box pops up, write in the message something like: "renamed file to something more specific". Then click the "Commit changes" button on the bottom of the message box.

Workshop material needs to be really precise to the tasks we're doing. Since this is on Git and GitHub, we need to be detailed about all the steps.

Since we'll repeat this many times, might be worth it to consider using {{< var >}} shortcodes to insert repeated text.

We also should be careful about saying colours. On my computer, I have it as blue (colour blind friendly).

Copy link
Member Author

@signekb signekb Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that’s some good points. I’ll create a short code with the commit steps.
About colours: could we write that it’s green by default or should we just omit the mention of a colour altogether?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make an issue to discuss this. We don't need to commit to it immediately ☺️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#75

Copy link
Member Author

@signekb signekb Mar 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the github-commit variable I just added I don’t mention the colour of the buttons 🟢


### Edit the content of `tomato-soup.md`

When we added the content of the file, you might have noticed that it
said "Ingredients for soup" on the first line. This is a bit generic, so
let's change it.

Like before, we'll click the `tomato-soup.md` file in the "Code" tab of the
repository to open it and click the pencil icon on the top-right side of
the page.

Now, let's change the first line of the file to "Ingredients for tomato soup".

Once we've made the changes, let's commit them.

### Move `tomato-soup.md` to a new `soups/` folder

Next, let's move the `tomato-soup.md` file to a new `soups/` folder.

As before, we'll click the `tomato-soup.md` file to open it and click the
pencil icon on the top-right side of the page.

Now, let's change the path of the file to a new folder in the repository, by
adding `soups/` before the file name like so: `soups/tomato-soup.md`.
Remember to use `/` between the folder name and the file name.

This will both create a new folder called `soups/` and move the
`tomato-soup.md` file into it.

::: callout-tip
## Fixing a folder name after typing slash `/`

You might have noticed that once we add the slash `/` after the folder
name, GitHub moves the cursor to the end of the file path, to the file
name. This might make it seem like we can't go back to the folder name
and correct it if we make a typo or change our mind about the name.

However, we can use the backspace key to remove the `/` which leads
the cursor back to the folder name. Now, we can change the folder name
as we like :partying_face:
:::

Let's click the green "Commit changes" button and commit the changes.

We have now renamed the soup recipe file, edited its content, and moved
it to a new folder in your repository! :bowl_with_spoon: :tomato:

::: callout-tip
## Rename, edit, and move files in the same step

It is possible to rename, edit, and move files in the same step if you want to.
However, for practice and clarity in the history, we've split the steps
into first renaming the file *then* moving it to a new folder.
:::

## :technologist: Exercise: Rename, edit, and move the `cookie-recipe.md` file

**Time: \~10 minutes**
Expand Down