Your First Edits to a File in Your Fork: Edit & Commit#
Now that you’ve identified and comment on an issue, forked the repository 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.
What you’ll learn
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.
How to edit a file in your fork#
GitHub lets you edit files right in your browser. Here’s how:
Navigate to your fork of the repository.
Find the file you want to edit.
Click the Edit button.
Make your changes and commit them.
⚡ 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. 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 |
Quick edits (typos, small fixes) |
No setup needed, edit in browser |
Can only commit one file at a time |
|
GitHub Codespaces |
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.
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, the version control system that GitHub runs in the background.
How commits work#
🛠 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.
What’s next?
Once you’ve committed your changes, you can open a pull request (PR) to suggest your edits to the main project.