You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
og:image:alt: An image that shows the steps for contributing to open source on GitHub.
19
19
---
20
20
21
-
# Your first edits to a file in your fork
21
+
# Your First Edits to a File in Your Fork: Edit & Commit
22
22
23
-
:::{todo}
24
-
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.
25
-
26
-
So I think we want to break this down into two things
23
+
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.
27
24
28
-
1. The drive-by pull request
25
+
> **💡 Reminder:** Your fix should be **small and text-based**, like updating documentation or fixing a typo.
29
26
30
-
* Click on the edit button in the repo that you want to make changes.
31
-
* If you don't have permission, it will automatically ask you about making a branch, which will be from your fork.
27
+
:::{admonition} What you'll learn
28
+
:class: tip
29
+
You’ll edit a file directly in your **fork** using GitHub’s interface and commit the changes using only the native GitHub interface.
32
30
33
-
2. The pr from your fork. If the fork already exists, then you can still edit the file.
31
+
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).
34
32
35
33
:::
36
34
37
-
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.
35
+
## How to edit a file in your fork
38
36
39
-
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.
37
+
GitHub lets you edit files right in your browser. Here’s how:
40
38
41
-
:::{admonition} What you'll learn here
42
-
:class: tip
43
-
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.
44
-
:::
45
-
46
-
Here, you will make the changes that you proposed to work on using only the native GitHub interface.
47
-
To do this, you do not need to [clone or make a copy of your repo locally](clone-repo).
39
+
1. Navigate to **your fork** of the repository.
40
+
2. Find the file you want to edit.
41
+
3. Click the <kbd><iclass="fa-solid fa-pencil"style="color: #81c0aa;"></i> Edit</kbd> button.
42
+
4. Make your changes and **commit** them.
48
43
49
44
:::{figure} /images/github/edit-commit-file.gif
45
+
:alt: "GIF showing how to edit and commit a file on GitHub."
50
46
47
+
Editing a file directly in the GitHub interface is a straight forward process.
51
48
:::
52
49
53
-
## About editing files on GitHub
54
-
55
-
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.
56
-
57
-
Following this process, you can edit as many files as you wish. However, on GitHub, you must edit and commit changes to them individually.
50
+
> **⚡ 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.
58
51
59
-
### Editing files on GitHub vs GitHub Codespaces vs Locally
60
52
61
-
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><iclass="fa-solid fa-pencil"></i></kbd> edit button. This approach is a great way to start contributing as you don't have to
53
+
## Editing files directly on GitHub vs. GitHub Codespaces
62
54
63
-
1. use the command line to edit the file
64
-
2. know how to use .git
55
+
GitHub now offers **two ways** to edit files directly in the interface or using the cloud based GitHub Codespaces:
65
56
66
-
However, the one small downside of this approach is that you can only edit and commit one file at a time.
57
+
| Option | When to Use | Pros | Limitations |
58
+
|---------|------------|------|-------------|
59
+
|**GitHub Interface** <iclass="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 |
60
+
|**GitHub Codespaces** <iclass="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 |
67
61
68
-
An alternative way to edit multiple files on GitHub is to use GitHub Codespaces.
62
+
> **💡 Need to edit multiple files using a coding editor like VsCode or Jupyter?** Learn more about using [GitHub Codespaces](github-codespaces).
69
63
70
-
[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.
71
-
72
-
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.
73
64
74
65
## What is a commit?
75
66
76
-
Here are 3 points to remember when you think about commits:
67
+
You can think of a **commit** as a save (or restore) point in git version control's history. Each commit captures changes that you make to one or more files in the repository at a specific point in time; each commit includes a note explaining what you did.
68
+
69
+
:::{tip}
70
+
A **commit** is a feature of [git version control](what-is-git), the version control system that GitHub runs in the background.
77
71
78
-
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.
72
+
:::
79
73
80
-
2. Each commit that you make represents a set of changes to one or more files in your repository at a specific time.
74
+
### How commits work
81
75
82
76
:::{figure} /images/github/git-commits-files.png
83
77
: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.
84
78
79
+
Each commit represents **a set of changes** at a specific time.
85
80
:::
86
81
87
-
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!
82
+
> **🛠 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.
: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.”
91
87
88
+
You can always **undo or revert** changes using Git.
92
89
:::
93
90
94
-
## Up next - create a pull request
91
+
## Up next: Make a pull request
92
+
93
+
Once you've committed your changes, you can open a **pull request (PR)** to suggest your edits to the main project.
94
+
95
+
[Learn how to create a pull request →](pull-request)
95
96
96
-
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.
97
97
98
98
:::{todo}
99
+
99
100
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??
101
+
102
+
103
+
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.
104
+
105
+
So I think we want to break this down into two things
106
+
107
+
1. The drive-by pull request
108
+
109
+
* Click on the edit button in the repo that you want to make changes.
110
+
* If you don't have permission, it will automatically ask you about making a branch, which will be from your fork.
111
+
112
+
2. The pr from your fork. If the fork already exists, then you can still edit the file.
Copy file name to clipboardExpand all lines: github-git/github-social-platform.md
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,9 @@ kernelspec:
13
13
14
14
# Community Interaction Best Practices on GitHub
15
15
16
-
🚧 These lessons are under heavy construction and will continue to change through March 2025 🚧
17
16
## Introduction
18
17
19
-
GitHub is more than just a platform for hosting code—it’s a **social platform** where developers, researchers, and contributors work together to create, improve, and share projects. Behind every username is a person who deserves respect and appreciation.
18
+
GitHub is more than just a platform for hosting code—it’s a **social platform** where developers, researchers, and contributors work together to create, improve, and share projects. Behind every username is a person who deserves respect and appreciation.
20
19
21
20
This lesson will teach you how to interact constructively and positively within the GitHub community. Whether submitting an issue, reviewing someone else’s work, or asking for help, following these best practices will help you collaborate effectively and maintain a welcoming environment.
22
21
@@ -25,16 +24,19 @@ This lesson will teach you how to interact constructively and positively within
25
24
Effective communication on GitHub ensures a productive and respectful collaboration environment. Whether you're raising an issue, reviewing code, or contributing to a discussion, these principles will help you interact constructively.
26
25
27
26
### Respect and professionalism
27
+
28
28
- Treat everyone with respect, even when disagreements arise.
29
29
- Remember that many maintainers and contributors volunteer their time and expertise to the community.
30
30
- Use polite and appreciative language when reaching out or giving feedback.
31
31
_Example: "Thank you for creating this tool. It's been really helpful!"_
32
32
33
33
### Patience
34
+
34
35
- Be understanding if responses to issues or pull requests take time.
35
36
- Open-source maintainers often juggle multiple responsibilities outside their projects.
36
37
37
38
### Clarity and thoughtfulness
39
+
38
40
-**Use clear and concise language**:
39
41
- Clearly describe issues, bugs, or suggestions to avoid confusion.
40
42
- Avoid unnecessary jargon or overcomplicating explanations.
@@ -46,19 +48,19 @@ Effective communication on GitHub ensures a productive and respectful collaborat
46
48
- Use **reactions** (like 👍 or ❤️) to express agreement or appreciation without cluttering threads with “+1” comments.
47
49
48
50
### Constructive feedback
51
+
49
52
- Avoid harsh language, blame, or criticism.
50
53
- Frame suggestions as questions or alternatives:
51
54
_"What if we try this approach?"_ instead of _"This is wrong."_
52
55
- Acknowledge positive aspects alongside suggestions for improvement.
53
56
54
57
:::{todo}
55
-
Move this to the pr page once I create it.
58
+
Move this to the pr page once I create it.
56
59
57
60
## 3. When Contributing to a Repository
58
61
59
-
60
-
61
62
### Opening Pull Requests
63
+
62
64
-**Describe the Change**: Clearly explain what you’re proposing and why it’s needed.
63
65
-**Follow Contribution Guidelines**: Adhere to any style or workflow rules outlined in the repository.
64
66
-**Be Open to Feedback**: Expect to receive suggestions for improvement and revise your pull request accordingly.
@@ -76,10 +78,12 @@ Here are key social cues to follow:
76
78
### 1️⃣ Help Maintainers Keep Track of Who’s Working on What
77
79
78
80
<iclass="fa-solid fa-list-check"style="color: #6ec9c3;"></i> **Open an issue first before submitting a PR.**
81
+
79
82
- This prevents duplicate work and ensures the maintainers **know who is working on what**.
80
83
- If an issue already exists, **comment on it** instead of creating a new one.
81
84
82
85
<iclass="fa-solid fa-triangle-exclamation"style="color: #6ec9c3;"></i> **Avoid surprising maintainers with a PR.**
86
+
83
87
- Some projects may not be ready for the change you're suggesting.
84
88
- Opening an issue first allows maintainers to **provide guidance before you start coding**.
85
89
@@ -88,10 +92,12 @@ Here are key social cues to follow:
88
92
### 2️⃣ Respect the Project’s Process
89
93
90
94
<iclass="fa-solid fa-book-open"style="color: #6ec9c3;"></i> **Follow issue templates and contribution guidelines.**
95
+
91
96
- Many projects have structured templates—**use them** to provide all necessary details.
92
97
- If guidelines exist, reference them in your issue to show you're **aligning with their workflow**.
93
98
94
99
<iclass="fa-solid fa-compass-drafting"style="color: #6ec9c3;"></i> **Ask before making major changes.**
100
+
95
101
- If your fix changes functionality, check with maintainers before proceeding.
96
102
- A simple “Would this be useful?” can save **time for both you and the maintainers**.
97
103
@@ -100,10 +106,12 @@ Here are key social cues to follow:
- If you know who maintains the repo, consider **@mentioning them** in your issue to establish a connection.
108
116
- Example: `@maintainer-name, I’d love to help fix this! Any guidance before I start?`
109
117
@@ -112,10 +120,12 @@ Here are key social cues to follow:
112
120
### 4️⃣ Communicate Like You Would in Real Life
113
121
114
122
<iclass="fa-solid fa-comments"style="color: #6ec9c3;"></i> **Be polite and professional.**
123
+
115
124
- Open source is about **collaborating with people you’ve never met**.
116
125
- Treat maintainers **as you would a colleague**—respectful and appreciative of their time.
117
126
118
127
<iclass="fa-solid fa-hand-wave"style="color: #6ec9c3;"></i> **Introduce yourself in your first issue comment.**
128
+
119
129
- If you’re new, a friendly introduction can make it easier to build relationships.
120
130
- Example:
121
131
> “Hey everyone! 👋 I’m new to contributing here and would love to help with this issue. Let me know if there’s anything I should consider before getting started!”
@@ -125,16 +135,19 @@ Here are key social cues to follow:
125
135
### 5️⃣ Build Trust Through Small Contributions
126
136
127
137
<iclass="fa-solid fa-user-check"style="color: #6ec9c3;"></i> **Start small to establish credibility.**
138
+
128
139
- First contributions aren’t just about code—they're about **building trust with the community**.
129
140
-**Small fixes** (like documentation updates or typo corrections) are a great way to get started.
130
141
131
142
<iclass="fa-solid fa-layer-group"style="color: #6ec9c3;"></i> **Contributions add up over time.**
143
+
132
144
- Even small changes **help the project grow** and demonstrate your commitment.
133
145
- Once maintainers recognize your contributions, they’re more likely to engage with your work.
Copy file name to clipboardExpand all lines: github-git/pull-request.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,20 +88,20 @@ You can also click on the commit titles to see the specific changes in each comm
88
88
89
89
### Step 4: Finalize and submit your PR
90
90
91
-
Once you've reviewed your PR and evertyhing looks good, it's time to submit it.
91
+
Once you've reviewed your PR and everything looks good, it's time to submit it.
92
92
93
93
Add a descriptive title and write a brief description of your changes. Pull request titles should be concise and descriptive of the content in the pull request. When you have added your
94
94
title and description, click on “Create Pull Request” one more time to submit the PR.
95
95
96
-
If you go to the parent repotiory you will see the PR listed there.
96
+
If you go to the parent repository, you will see the PR listed there.
97
97
98
98
:::{tip}
99
99
You can modify the title and description of your pull request at any time - even after you've submitted the pull request.
100
100
:::
101
101
102
102
## Close a Pull Request
103
103
104
-
If you're not ready to submit, you can close a PR anytime via the **Close pull request** button. You can reopen it later if needed.
104
+
You can close a PR anytime via the **Close pull request** button if you're not ready to submit. You can reopen it later if needed.
0 commit comments