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:

  1. Navigate to your fork of the repository.

  2. Find the file you want to edit.

  3. Click the Edit button.

  4. Make your changes and commit them.

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. 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#

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.

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.#

What’s next?

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 →