Skip to content

Commit

Permalink
add: new content to edit file lesson
Browse files Browse the repository at this point in the history
docs: update README.md [skip ci]

docs: update .all-contributorsrc [skip ci]

add: edit lesson

fix: pr page plus screencasts

fix: rename and reorg

add: metadata to core pages

rewrite: social cues added throughout

fix: metadata

fix: add social elements

fix: cleanup and add social context

fix: edits from group review

fix: new landing page - intro

Fix: final edits to lessons

fix: links
  • Loading branch information
lwasser committed Feb 4, 2025
1 parent ae6bdb1 commit c8e7ff3
Show file tree
Hide file tree
Showing 32 changed files with 839 additions and 168 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
"code",
"review"
]
},
{
"login": "jsdodge",
"name": "J. Steven Dodge",
"avatar_url": "https://avatars.githubusercontent.com/u/4602669?v=4",
"profile": "https://www.sfu.ca/lux/author/j.-steven-dodge/",
"contributions": [
"review"
]
}
],
"contributorsPerLine": 7,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<td align="center" valign="top" width="14.28%"><a href="http://blog.ucodery.com"><img src="https://avatars.githubusercontent.com/u/28751151?v=4?s=100" width="100px;" alt="Jeremy Paige"/><br /><sub><b>Jeremy Paige</b></sub></a><br /><a href="https://github.com/pyOpenSci/lessons/pulls?q=is%3Apr+reviewed-by%3Aucodery" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://hachyderm.io/web/@willingc"><img src="https://avatars.githubusercontent.com/u/2680980?v=4?s=100" width="100px;" alt="Carol Willing"/><br /><sub><b>Carol Willing</b></sub></a><br /><a href="https://github.com/pyOpenSci/lessons/pulls?q=is%3Apr+reviewed-by%3Awillingc" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://jon-e.net"><img src="https://avatars.githubusercontent.com/u/12961499?v=4?s=100" width="100px;" alt="Jonny Saunders"/><br /><sub><b>Jonny Saunders</b></sub></a><br /><a href="https://github.com/pyOpenSci/lessons/commits?author=sneakers-the-rat" title="Code">💻</a> <a href="https://github.com/pyOpenSci/lessons/pulls?q=is%3Apr+reviewed-by%3Asneakers-the-rat" title="Reviewed Pull Requests">👀</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://www.sfu.ca/lux/author/j.-steven-dodge/"><img src="https://avatars.githubusercontent.com/u/4602669?v=4?s=100" width="100px;" alt="J. Steven Dodge"/><br /><sub><b>J. Steven Dodge</b></sub></a><br /><a href="https://github.com/pyOpenSci/lessons/pulls?q=is%3Apr+reviewed-by%3Ajsdodge" title="Reviewed Pull Requests">👀</a></td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 3 additions & 3 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

# -- Project information -----------------------------------------------------

project = "pyOpenSci Python Package Guide"
project = "pyOpenSci Open Source Lessons"
copyright = f"{current_year}, {organization_name}"
author = "pyOpenSci Community"
# Version is needed to avoid "cant describe anything fatal error"
Expand Down Expand Up @@ -105,11 +105,11 @@
# "text": "Python Packaging",
"image_dark": "logo-dark-mode.png",
"image_light": "logo-light-mode.png",
"alt_text": "pyOpenSci Python Package Guide. The pyOpenSci logo is a purple flower with pyOpenSci under it. The o in open sci is the center of the flower",
"alt_text": "pyOpenSci Open Source Lessons. The pyOpenSci logo is a purple flower with pyOpenSci under it. The o in open sci is the center of the flower",
},
# Increase this as lessons are added -
# set low to hide links to other pyos sites and allow nav between lessons
"header_links_before_dropdown": 3,
"header_links_before_dropdown": 5,
"use_edit_page_button": True,
"show_nav_level": 2,
"navigation_depth": 3,
Expand Down
45 changes: 0 additions & 45 deletions github-git/4-edit-commit-files.md

This file was deleted.

14 changes: 0 additions & 14 deletions github-git/5-pull-request.md

This file was deleted.

11 changes: 8 additions & 3 deletions github-git/6-clone-repo.md → github-git/clone-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
myst_html_meta:
"title": "How to Clone a GitHub Repository to Work Locally: Collaborative GitHub for beginners"
"description lang=en": "Learn how to clone or make a copy of a GitHub repository online on your computer so you can work locally."
"keywords": "GitHub, OpenSource"
"property=og:locale": "en_US"
---

(clone-repo)=
(clone-repository)=
# Clone a GitHub Repository to Work Locally
How to clone a repo.

Expand All @@ -38,13 +43,13 @@ On the main **GitHub.com** page of the repository, you can click on the green bu

`https://github.com/your-username/repo-name`


::::{todo}
:::{figure} /images/github/image-coming-soon.png
:alt: alt text here

You can make a local copy of your forked repository on your computer with the git clone command.
:::

::::

:::{tip}
You can copy the URL directly from your web browser, or in some cases, you might already know the URL. However, in many cases, you will come across a new **GitHub.com** repository on your own and will need to follow these instructions to copy the URL for future use.
Expand Down
104 changes: 104 additions & 0 deletions github-git/edit-commit-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
jupytext:
text_representation:
extension: .md
format_name: myst
format_version: 0.13
jupytext_version: 1.16.4
kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
myst_html_meta:
"title": "How to edit and commit changes to a file on GitHub: Intro to Collaborative GitHub"
"description lang=en": "Learn how to edit a file and then commit changes to that file to version control. All in the GitHub interface."
"keywords": "GitHub, OpenSource, beginner-friendly"
"property=og:locale": "en_US"
og:image: /images/github/steps-to-contribute.png
og:image:alt: An image that shows the steps for contributing to open source on GitHub.
---

# Your First Edits to a File in Your Fork: Edit & Commit

Now that you've [identified and comment on an issue](identify-issue), [forked the repository](fork-repo) and received approval to work on an issue, it's time to make your changes.

> **💡 Reminder:** Your fix should be **small and text-based**, like updating documentation or fixing a typo.
:::{admonition} What you'll learn
:class: tip
You’ll edit a file directly in your **fork** using GitHub’s interface and commit the changes using only the native GitHub interface.

NOTE: If you want to work on the files locally on your laptop, you will need to [clone or make a copy of your repo locally](clone-repo).

:::

## How to edit a file in your fork

GitHub lets you edit files right in your browser. Here’s how:

1. Navigate to **your fork** of the repository.
2. Find the file you want to edit.
3. Click the <kbd><i class="fa-solid fa-pencil" style="color: #81c0aa;"></i> Edit</kbd> button.
4. Make your changes and **commit** them.

:::{figure} /images/github/edit-commit-file.gif
:alt: "GIF showing how to edit and commit a file on GitHub."

Editing a file directly in the GitHub interface is a straight forward process.
:::

> **⚡ Quick tip:** You can edit as many files as you want, but GitHub only lets you commit them **one at a time** in the browser.

## Ways to edit a file: GitHub vs. GitHub Codespaces

GitHub now offers **two ways** to edit files directly in the interface or using the [cloud-based GitHub Codespaces](about-codespace). If you’re making a small change, use GitHub’s interface. If you need to edit multiple files, try Codespaces.

| | Option | When to Use | Pros | Limitations |
|-|---------|------------|------|-------------|
| | **GitHub Interface** <i class="fa-solid fa-pencil" style="color: #81c0aa;"></i> | Quick edits (typos, small fixes) | No setup needed, edit in browser | Can only commit one file at a time |
| | **GitHub Codespaces** <i class="fa-solid fa-laptop-code" style="color: #81c0aa;"></i> | Editing multiple files | Full VS Code environment in browser | Requires configuration but once configured, you can reuse it |

> **💡 Need to edit multiple files using a coding editor like VsCode or Jupyter?** Learn more about using [GitHub Codespaces](github-codespaces).
## What is a commit?

A commit is like taking a snapshot of your changes so you can always "undo" the changes if needed. You can think of a **commit** as a save (or restore) point in git's history. Each commit captures changes you make to one or more files in the repository at a specific time; each commit includes a note explaining what you did.

:::{tip}
A **commit** is a feature of [git version control](what-is-git), the version control system that GitHub runs in the background.

:::

### How commits work

:::{figure} /images/github/git-commits-files.png
:alt: A visual example demonstrating how Git tracks changes to a document through commits. The image shows an “Original File” with its initial text, followed by two commits. The first commit adds a new paragraph of text, with the changes highlighted in green and the commit message, “Fix: added a new paragraph to clarify text.” The second commit fixes typos in the text, with the edits highlighted in green and the commit message, “Fix: copy edits.” At the bottom, a comparison shows the document after each commit, illustrating how the file evolves with changes.

Each commit represents **a set of changes** at a specific time.
:::

> **🛠 Do you need to undo changes that you made?** Git lets you revert to an earlier commit, so you don’t have to worry about breaking anything.

:::{figure} /images/github/git-what-are-commits.png
:alt: A diagram explaining Git commits and their role in version control. The top section shows a timeline of circular commits, each paired with a file icon to represent file changes, with the text: “Each commit represents one or more file changes made at a specific point in time.” The middle section highlights the “Latest Commit” on the timeline, showing it as the current state of the repository. The bottom section demonstrates the concept of reverting, with an arrow pointing from a later commit back to a previous one, illustrating that Git allows reverting or going back to earlier commits. The text reads: “You can also always revert or return to a previous commit. This is what makes Git powerful.”

You can always **undo or revert** changes using Git.
:::

:::{admonition} What's next?
:class: seealso

<i class="fa-brands fa-github-alt"></i> Once you've committed your changes, you can open a **pull request (PR)** to suggest your edits to the main project.

*****

[Learn how to create a pull request →](pull-request)
:::


:::{todo}

It might be cool to show first contributions like my first on to nbconvert could be interesting? Other people might have examples from the community that we could share some stories about.
:::
26 changes: 12 additions & 14 deletions github-git/3-fork-repo.md → github-git/fork-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ myst_html_meta:
---

(fork-repository)=
# A Guide to Forks on GitHub Forks

# A Guide to Forks on GitHub Forks

:::{admonition} What You Will Learn
:class: tip
Expand All @@ -39,7 +39,7 @@ Forking a repository **creates a copy** in your GitHub account while keeping a l

- <i class="fa-solid fa-pencil" style="color: #81c0aa;"></i> **Edit without concern**: Work on your fork without affecting the original project.
- <i class="fa-solid fa-arrows-rotate" style="color: #81c0aa;"></i> **Stay up to date**: Sync your fork with the latest changes from the original repo.
- <i class="fa-solid fa-paper-plane" style="color: #81c0aa;"></i> **Propose changes**: Suggest edits by submitting a **pull request** to the original repository.
- <i class="fa-solid fa-paper-plane" style="color: #81c0aa;"></i> **Propose changes**: Suggest edits by submitting a **pull request** to the original repository.

> **<i class="fa-solid fa-lightbulb" style="color: #81c0aa;"></i> Example**: You want to fix a typo in a project’s documentation. Instead of requesting permission, you fork the repo, make the fix, and submit a pull request with your update.
Expand All @@ -64,20 +64,17 @@ The URL of your fork will be:

`https://github.com/your-username/pyos-demo-package-contribute`


:::{tip}
The number next to the <kbd><i class="fa-solid fa-code-fork"></i> button tells you how many times other users have forked the repository.
The number next to the <kbd><i class="fa-solid fa-code-fork"></i> button tells you how many times other users have forked the repository.
:::


:::{figure} /images/github/fork-repo-animated.gif
:alt: GIF showing how to fork a repository on GitHub
:alt: GIF showing how to fork a repository on GitHub

To fork a repo, navigate to it on GitHub and click the **Fork** button. Your copy will appear under your account.
:::


:::{admonition} Who owns the repo?
:::{admonition} Who owns the repo?

Every GitHub repository has an **owner**, which can be:

Expand All @@ -87,16 +84,16 @@ Every GitHub repository has an **owner**, which can be:
The **owner’s username appears first in the URL**, showing who controls the repository.

**Example**:
- A personal repo: `https://github.com/your-gh-username/my-project`
- An organization-owned repo: `https://github.com/pyOpenSci/repo-name`

- A personal repo: `https://github.com/your-gh-username/my-project`
- An organization-owned repo: `https://github.com/pyOpenSci/repo-name`

If you **fork a repo**, your GitHub username becomes the owner of the fork:

> **Forked URL:** `https://github.com/your-username/repository-name`
:::


## What happens after you fork a repo?

Your fork **is a separate copy**, but it remains linked to the original repository.
Expand All @@ -105,27 +102,28 @@ Your fork **is a separate copy**, but it remains linked to the original reposito
- **The original repo stays at:** `https://github.com/original-owner/repository-name`

> **<i class="fa-solid fa-lightbulb" style="color: #81c0aa;"></i> You can now:**
>
> - Make changes without affecting the original repository.
> - Keep your fork updated as the original repo evolves.
> - Submit changes back using a **pull request**.
::::{todo}
/images/github/fork-structure.png
:alt: "Diagram showing how forking creates a personal copy linked to the original."
Graphic: A simple diagram showing "Original Repo → Fork → Your Account".
::::


## Keep your fork in sync

Your fork doesn't automatically get updated when the **original repository is updated**. Periodically, you will need to **sync your fork** to keep it current.

To sync a GitHub fork:

1. **Go to your fork** on GitHub.
2. **Click the** <i class="fa-solid fa-arrows-rotate" style="color: #81c0aa;"></i> **Sync fork** **button** (available on GitHub’s UI).
3. Your fork's main branch will now match the latest version of the original repository. This means that it has the most recent commits that have been made to the parent repository.

:::{todo}
:::{todo}
/images/github/sync-fork.png
:alt: "GitHub interface showing how to sync a fork with the original repo."
Graphi: Screenshot of GitHub’s "Sync Fork" button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Before contributing, it's important to **familiarize yourself with the repositor
### 1. Check the README and CONTRIBUTING guide

The **README** provides an overview of the project, its purpose, and how it is used. Often, it also links to the project's contributing and development guides.

- **Review the README file**: The [**README.md** file](https://github.com/pyOpenSci/pyos-demo-package-contribute/blob/main/README.md) will help you understand the project's goals.
- **Read the CONTRIBUTING guide**: The [**CONTRIBUTING.md** file](https://github.com/pyOpenSci/pyos-demo-package-contribute/blob/main/CONTRIBUTING.md) explains what types of contributions are accepted and the expected workflow.

Expand All @@ -43,6 +44,7 @@ Above is a screenshot of the pyOpenSci practice repo that you will use. Notice t
:::

(labels-responsive)=

### 2. Look at project activity and maintainer responsiveness

- Scan the **issues and pull requests** sections on GitHub to see how long it generally takes for maintainers to respond.
Expand All @@ -54,17 +56,19 @@ Above is a screenshot of the pyOpenSci practice repo that you will use. Notice t
### 3. Understand the project’s infrastructure

Some repositories have specific **code and text format and workflow requirements**. Make sure to check if the project uses:

- **Code formatters and linters**: Does the project use [code formatters or linters](https://www.pyopensci.org/python-package-guide/package-structure-code/code-style-linting-format.html#python-package-code-style-format-and-linters)?
- **Continuous Integration (CI)**: Are there automated tests and checks that run when a new PR is submitted?
- **Licensing**: The [project’s license](https://www.pyopensci.org/python-package-guide/documentation/repository-files/license-files.html) dictates how you can use, modify, and distribute the code.
- The **MIT and BSD-3 licenses** permit broad use with attribution; these licenses are common in the scientific open source ecosystem.
- A **GPL license** requires derivative works to follow the same open source terms. This is what's known as a [copy-left license](https://www.pyopensci.org/python-package-guide/documentation/repository-files/license-files.html#use-open-permissive-licenses-when-possible).
- A **GPL license** requires derivative works to follow the same open source terms. This is what's known as a [copy-left license](https://www.pyopensci.org/python-package-guide/documentation/repository-files/license-files.html#use-open-permissive-licenses-when-possible).

> **<i class="fa-solid fa-circle-check" style="color: #81c0aa;"></i> Social cue:** If the project follows **consistent coding standards and has CI in place**, it likely has an **organized review process**, that is setup to accept contributions. Further, if the project uses tools such as the [pre-commit ci bot](https://www.pyopensci.org/python-package-guide/package-structure-code/code-style-linting-format.html#pre-commit-ci), code formatting and linting might be possible on GitHub within the pull request it self using CI. This means you won't need to setup a development environment to "clean up" any changes that you make in a PR.
### 4. Check for a Code of Conduct

A **Code of Conduct** helps ensure a **welcoming and respectful** community.

- If one exists, read it to understand community expectations.
- If missing, check discussions in issues and pull requests to gauge how maintainers interact with contributors.

Expand All @@ -81,6 +85,6 @@ A **Code of Conduct** helps ensure a **welcoming and respectful** community.

The above steps will help you determine whether a project is **welcoming, responsive, and well-maintained**, making it a great place to contribute! 🚀


## Next steps

Once you have explored and gotten to know the repository and decided that it's a good project to contribute to, it's time to [find an issue to work](identify-issue). You will learn more about that next.
Loading

0 comments on commit c8e7ff3

Please sign in to comment.