Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 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
65 changes: 0 additions & 65 deletions github-git/0-first-contribution.md

This file was deleted.

85 changes: 0 additions & 85 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.

7 changes: 6 additions & 1 deletion 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 Down
100 changes: 100 additions & 0 deletions github-git/edit-commit-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
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

:::{todo}
Github has changed things a bit. If you edit the file in place, it automatically directs you to a pr workflow in the repo that you are in.

So I think we want to break this down into two things

1. The drive-by pull request

* Click on the edit button in the repo that you want to make changes.
* If you don't have permission, it will automatically ask you about making a branch, which will be from your fork.

2. The pr from your fork. If the fork already exists, then you can still edit the file.

:::

In the previous lesson, [you identified something that you wanted to fix in our example GitHub repository](identify-issue). Ideally, the fix that you identified is small, text-based, and can be made by modifying a single file.

After you [forked the repository that you want to contribute to](fork-repo) and received approval from a maintainer to work on the issue, it's time to start making the changes you suggested.

:::{admonition} What you'll learn here
:class: tip
In this lesson, you will edit a file in the demo pyOpenSci repository using the GitHub interface in your [forked repo](fork-repo). You will then commit your changes.
:::

Here, you will make the changes that you proposed to work on using only the native GitHub interface.
To do this, you do not need to [clone or make a copy of your repo locally](clone-repo).

:::{figure} /images/github/edit-commit-file.gif

:::

## About editing files on GitHub

Editing a file on GitHub allows you to focus on the contributing workflow without needing to learn or install git, create a local development environment, or use the command line.

Following this process, you can edit as many files as you wish. However, on GitHub, you must edit and commit changes to them individually.

### Editing files on GitHub vs GitHub Codespaces vs Locally

In the above image, you edit the file online at GitHub.com. To do this, you navigate to the page that you want to edit and click on the <kbd><i class="fa-solid fa-pencil"></i></kbd> edit button. This approach is a great way to start contributing as you don't have to

1. use the command line to edit the file
2. know how to use .git

However, the one small downside of this approach is that you can only edit and commit one file at a time.

An alternative way to edit multiple files on GitHub is to use GitHub Codespaces.

[GitHub codespaces](github-codespaces) provide online GitHub development environments that allow you to edit multiple files and commit them together using an IDE (interactive development environment) such as VsCode.

Sometimes, maintainers will set up a codespace for you to use. Or, you can also set one up yourself in your fork. GitHub codespaces also come with GitHub setup, which means that you can commit files to your fork within VsCODE vs needing to know how to use the command line.

## What is a commit?

Here are 3 points to remember when you think about commits:

1. A **commit** is a feature of [git version control](what-is-git) that is similar to saving your changes with a note explaining what you did.

2. Each commit that you make represents a set of changes to one or more files in your repository at a specific time.

:::{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.

:::

3. Because you are using git, you can always revert or undo a set of changes in your commit history. While undoing things in git takes a bit more knowledge, knowing it can be done can give you the confidence to make changes without worrying about breaking things!

:::{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.”

:::

## Up next - create a pull request

Once you have made the changes to the files that you wish to change in your branch, you are ready to open a [pull request](pull-request). You will learn how to do that next.

:::{todo}
It might be cool to show first contributions like my first on to nbconvert could be interesting? Other people might have examples too from the community that we could share with some stories about it??
:::
30 changes: 8 additions & 22 deletions github-git/3-fork-repo.md → github-git/fork-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
myst_html_meta:
"title": "How to fork a GitHub repository and make a copy of it in your GitHub account: Intro to Collaborative GitHub"
"description lang=en": "A complete guide to forking or making a copy of a GitHub repository that you don't own into your own account."
"keywords": "GitHub, OpenSource, beginner-friendly"
"property=og:locale": "en_US"
---

(fork-repository)=
Expand All @@ -21,25 +26,6 @@ kernelspec:
In this lesson, you will learn how to <kbd>fork</kbd> (or create a copy of) a GitHub repo into your own **GitHub.com** account. You can practice forking the pyOpenSci example repository.
:::

:::{admonition} Activity: Fork a repository and modify a file

**1. Fork the pyOpenSci practice GitHub repository**
*******

Fork the <a href="http://www.github.com/pyopensci/repo-here" target="_blank">pyOpenSci demo repository on GitHub</a>. Remember that a fork is a copy of a repository that is owned by someone else or an organization that lives in your GitHub account.

**2. Open the file that you proposed changes to in the issue you selected in the [how to identify an issue lesson](2-identify-issue).**
*******

In the previous issue, you selected or identified something that you wanted to fix in a GitHub repo. Ideally, if this is your first contribution, that fix is small and could potentially be completed in the GitHub online interface.

* Select the file that you decided to work on in GitHub
* Click on the edit <kbd><i class="fa-solid fa-pencil"></i></kbd> button in the GitHub interface.
* Make the edits that you proposed to make.
* Hit the <kbd>commit</kbd> button to save your edits

If you need more guidance, an overview of all of these steps is below.
:::


## How to fork a GitHub repository
Expand All @@ -48,13 +34,13 @@ To fork a GitHub repository:

1. Navigate to the repo page that you wish to <kbd><i class="fa-solid fa-code-fork"></i> Fork</kbd> - for example:

`https://github.com/pyopensci/repo-name`
`https://github.com/pyopensci/pyos-demo-package-contribute`

2. On that page, you will see a button in the upper right-hand corner that says <kbd><i class="fa-solid fa-code-fork"></i> Fork</kbd>. The number next to that button tells you how many times the repository has already been forked by other users (or how many other repository copies exist on GitHub.com.
3. Click on the <kbd><i class="fa-solid fa-code-fork"></i> Fork</kbd> button and select your user account when it asks you where you want to fork the repo.
4. Once you have forked the repo, you will have a copy in your account. Navigate to your repo page. The URL should look something like this:

`https://github.com/your-user-name/repo-name`
`https://github.com/your-user-name/pyos-demo-package-contribute`


:::{figure} /images/github/fork-repo-animated.gif
Expand All @@ -79,7 +65,7 @@ For example, the repository that you will work within this lesson is owned by `p

`https://github.com/pyopensci/repo-name`

(fork-repo)=

## What is forking a GitHub repository?

:::{figure} /images/github/fork-repo.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ kernelspec:
display_name: Python 3 (ipykernel)
language: python
name: python3
myst_html_meta:
"title": "Get to know a (new to you) GitHub repository: Contribute to Open Source code and documentation."
"description lang=en": "It's useful to get to know a GitHub repo by reading the README and CONTRIBUTING files before getting started. Learn what to look for when getting to know a new repository. A beginner-friendly guide."
"keywords": "GitHub, OpenSource, beginner-friendly"
"property=og:locale": "en_US"
---

(get-to-know-repo)=
# Get to Know a (new to you) GitHub Repository

:::{admonition} What you will learn:
Expand All @@ -22,20 +26,7 @@ In this tutorial, you will get to know a GitHub repo that you want to contribute

The activity that you will complete is below. Read on, however, to learn more about the steps.

:::{admonition} Activity 1: Get to know the repository

In your browser, navigate to [https://github.com/pyOpenSci/pyos-demo-package-contribute/](https://github.com/pyOpenSci/pyos-demo-package-contribute/).

* Check out the README and CONTRIBUTING files.

### Answer these questions

* Does the repository accept contributions? If so, what types of contributions are accepted?
* Does the repository use specific code or text formatting standards or liters?
* Does the repository have continuous integration (CI) set up?
* What is the license associated with the code in the repository?
* Are the issues labeled and are there "good first issue" or "help wanted" labels
:::

(contributing)=
## How to get to know a repo
Expand Down
Loading