Chapter 22: Git GitHub Edit Code

What is Git + GitHub Edit Code?”

This usually means one (or both) of two very common things beginners ask about:

  1. How do I edit code in my local Git repository (on my laptop) and then commit + push those changes to GitHub?
  2. How do I directly edit code files right on GitHub.com in the browser (without using my laptop at all)?

Both are important, but they serve very different purposes.

I’m going to explain both in detail, step-by-step, like we’re sitting together on your laptop + browser, with real examples.

Part 1 – Editing code locally (on your laptop) → commit → push to GitHub

(This is the normal, most powerful, everyday way professional developers work)

Step-by-step example

Assume you already have a repo cloned from GitHub (or you followed our previous “Getting Started” lesson).

Bash

Now open your project folder in your favorite editor:

  • VS Code → code .
  • Notepad++ / Sublime / Vim / whatever you like

Let’s pretend the project has this simple index.html:

HTML

You want to edit it → add a search input at the top.

Change it to:

HTML

Save the file (Ctrl+S or File → Save).

Now Git knows something changed:

Bash

You see:

text

Stage & commit:

Bash

Push to GitHub:

Bash

→ Go to GitHub.com → your repo → you see the new branch → Click “Compare & pull request” → create PR → team can review your edit

This is the standard flow — edit locally → commit → push → PR

Part 2 – Editing code directly on GitHub.com (in browser)

This is very useful when:

  • You’re on a phone/tablet without your laptop
  • You want to fix a typo quickly
  • You’re contributing to someone else’s open-source project
  • You don’t have the repo cloned locally yet

Step-by-step example (browser-only edit)

  1. Go to your repo on github.com → https://github.com/Webliance/todo-app-2026

  2. Click on any file → for example README.md or index.html

  3. Click the pencil icon (✏️) in top-right of file view → “Edit this file”

  4. Make your change right in the browser editor:

    Example – add a new line to README.md:

    text
  5. Scroll down → you see three fields:

    • Commit message (very important – write a good one!) Example: docs: add dark mode roadmap to README
    • Extended description (optional – explain more)
    • Commit directly to the main branch OR Create a new branch and start a pull request

    Best practice in 2026 → almost always choose: “Create a new branch for this commit and start a pull request” → GitHub auto-creates branch like patch-1 or webliance-patch-1

  6. Click green Commit changes or Propose changes

→ If you chose new branch + PR → you land on Pull Request page → you can add description, assign reviewers, etc.

Result:

  • Your edit is now safely on GitHub
  • No local Git needed
  • If it’s your repo → you can later merge the PR yourself
  • If it’s someone else’s repo → they get a nice PR with your change

Quick Comparison Table (2026 perspective)

Way to edit code Where you edit Requires local Git setup? Best for Commit message control Can create branch/PR automatically?
Locally (laptop) VS Code / any editor Yes Real development, large changes, debugging Full control Manual (but easy)
Directly on GitHub.com Browser text editor No Quick fixes, typos, mobile, first contributions Good (but small box) Yes – one click

Pro Tips & Best Practices (2026)

  • Always write meaningful commit messages — even on GitHub.com Bad: “Update README.md” Good: “docs(readme): add contribution guidelines section”

  • For serious work → always prefer local edit (you get linting, auto-format, Git diff preview, debugging…)

  • On GitHub.com → use “Suggest changes” when reviewing someone else’s PR (very common in teams)

  • If you edited on GitHub.com and want those changes locally later:

    Bash

Got the two ways clear now?

  • Local edit = full power, daily development
  • GitHub.com edit = quick, browser-only, great for small fixes & contributions

Next?

  • Want to see how to resolve a conflict after editing on GitHub.com?
  • How to review & merge your own browser PR locally?
  • Or move to .gitignore / conventional commits?

Just tell me — we’ll continue the class. You’re doing really well! 🚀

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *