GitHub lets you edit any file directly in the browser without installing anything. Click the pencil icon on any file to open the built-in editor, or press the period key (.) on any repo page to open github.dev — a full VS Code-like editor in your browser. Make your changes, write a commit message, and click Commit changes. Every edit is saved as a commit so you can always undo it.
Two Ways to Edit Files Directly on GitHub
When you need to fix a typo, update a configuration value, or tweak a line of code, you do not need to download anything. GitHub provides two browser-based editors. The first is the simple built-in editor — click the pencil icon on any file and you get a text area where you can make changes. The second is github.dev, a lightweight VS Code editor that opens when you press the period key (.) on any repository page. The github.dev editor gives you syntax highlighting, multi-file editing, and a file explorer sidebar — all without installing software. This is particularly useful when you are working with AI-generated code from tools like Cursor or V0 and need to make quick adjustments before merging. Every edit you save creates a new commit, which means GitHub keeps a full history of changes and you can revert any edit at any time.
Prerequisites
- A free GitHub account (sign up at github.com)
- A repository with at least one file in it
- Write access to the repository (you are the owner or a collaborator)
Step-by-step guide
Open the file you want to edit
Open the file you want to edit
Go to your repository on github.com and navigate to the file you want to change. Click through folders in the file list until you find it, then click the file name to open it. GitHub displays the file contents with syntax highlighting for code files and rendered formatting for Markdown files.
Expected result: The file content is displayed in the browser with a toolbar above it.
Click the pencil icon to enter edit mode
Click the pencil icon to enter edit mode
Look at the toolbar above the file content. You will see a row of icons on the right side. Click the pencil icon (it looks like a small pen or edit symbol). This opens the file in a simple text editor where you can make changes directly. The editor shows line numbers on the left and the full file content in an editable text area. For Markdown files, you can switch between the "Edit" and "Preview" tabs to see how your changes will look.
Expected result: The file opens in edit mode with a text area where you can type changes.
Make your changes in the editor
Make your changes in the editor
Click anywhere in the text area and type your changes. You can add new lines, delete text, or modify existing content. Use Ctrl+F (or Cmd+F on Mac) to search within the file. The editor supports standard keyboard shortcuts for undo (Ctrl+Z), redo (Ctrl+Shift+Z), and select all (Ctrl+A). If you are editing a Markdown file like README.md, click the "Preview" tab to see how your formatting will render.
Expected result: Your changes are visible in the editor. Nothing is saved yet.
Commit your changes
Commit your changes
Click the green "Commit changes..." button in the top-right corner of the editor. A dialog box appears with two fields: a short commit message (summary) and an optional extended description. Replace the default message with something descriptive like "Fix typo in installation instructions" or "Update API endpoint URL." Make sure "Commit directly to the main branch" is selected, then click the green "Commit changes" button in the dialog.
Expected result: GitHub saves your edit and redirects you to the updated file view with your changes visible.
Try the github.dev editor for advanced editing (optional)
Try the github.dev editor for advanced editing (optional)
Go back to your repository's main page. Press the period key (.) on your keyboard. GitHub opens the repository in github.dev — a browser-based VS Code editor. You get a file explorer sidebar on the left, tabbed editing, syntax highlighting, and search across files (Ctrl+Shift+F). Make edits in any file, then click the Source Control icon in the left sidebar (it looks like a branch with a circle). Type a commit message and click the checkmark icon to commit your changes.
Expected result: The repository opens in a VS Code-like interface in your browser where you can edit multiple files and commit all changes at once.
Complete working example
1# My Project23Welcome to the project! This README was edited directly on GitHub.45## Getting Started67Visit the [live demo](https://example.com) to see the app in action.89## Configuration1011| Setting | Value | Description |12|------------|---------------|-------------------------|13| API_URL | /api/v2 | Backend endpoint |14| THEME | dark | Default color theme |15| LANGUAGE | en | Default locale |1617## Contributing18191. Fork this repository202. Create a new branch213. Make your changes using the GitHub web editor224. Open a pull request2324## License2526MITCommon mistakes when editing a File in a GitHub Repository
Why it's a problem: Editing a file on the wrong branch
How to avoid: Check the branch dropdown in the top-left of the file view before clicking the pencil icon. Switch to the correct branch first.
Why it's a problem: Accidentally committing directly to main instead of creating a branch
How to avoid: In the commit dialog, select 'Create a new branch for this commit and start a pull request' to keep main safe.
Why it's a problem: Using the default commit message like 'Update README.md'
How to avoid: Write a specific message that describes what you changed and why, such as 'Add setup instructions for new developers.'
Why it's a problem: Not previewing Markdown changes before committing
How to avoid: Click the Preview tab in the editor to check that headings, links, and formatting render correctly before you commit.
Best practices
- Always check which branch you are on before editing a file.
- Write commit messages that explain why you made the change, not just what changed.
- Use the Preview tab for Markdown files to verify formatting before committing.
- For multi-file edits, use the github.dev editor (press .) instead of editing files one by one.
- Create a new branch for significant changes instead of committing directly to main.
- Review your changes in the diff view before confirming the commit.
- Use Ctrl+F / Cmd+F to find the exact line you need to change in large files.
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I need to edit a configuration file in my GitHub repository. What is the best way to update environment-specific values in a JSON config file directly on GitHub without downloading the repo?
Frequently asked questions
Can I edit any file type on GitHub, or only text files?
You can edit any text-based file (code, Markdown, JSON, YAML, CSV, etc.) using the pencil icon or github.dev editor. Binary files like images or PDFs cannot be edited in the browser — you need to re-upload them.
What is the difference between the pencil icon editor and github.dev?
The pencil icon opens a simple single-file text editor. The github.dev editor (press the period key) opens a full VS Code-like environment where you can edit multiple files, use search-and-replace across the project, and see a file tree sidebar.
Can I undo an edit after I commit it?
Yes. Every commit is saved in the history. Go to the file, click the History button to see all past commits, find the version before your edit, and use that to restore the old content.
Will editing a file on GitHub affect my Lovable or Cursor project?
If your Lovable or Cursor project is connected to the same GitHub repository, changes you make on GitHub will sync to your project. Lovable syncs two-way on the main branch, so edits on GitHub appear in Lovable automatically.
Is the github.dev editor free to use?
Yes. The github.dev editor is completely free for all GitHub users, including free accounts. It works on any public or private repository you have access to.
Can I hire someone to manage my GitHub repository for me?
Yes. Teams like RapidDev specialize in helping non-technical founders manage code repositories, set up workflows, and maintain projects built with AI tools.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation