Editing and Uploading Files
You can change a repository from any browser. Every save on GitHub is a commit with a message.
On this page · 5 min · Beginner
On this page
- Learning objectives
- Explanation
- Step-by-step screens
- Code example
- Step by step
- Real-world use
- Common mistakes
- Best practices
- Remember this
- Practice exercise
- Mini quiz
- Related topics
- My notes
- Reading time
- 5 min
- Difficulty
- Beginner
- Updated
- Nov 25, 2026
Related tutorials
Learning objectives#
- Create a new file on GitHub
- Upload files from your computer
- Edit a file and commit the change
- Write a useful commit message
Explanation#
On the repository page, Add file ▾ offers Create new file and Upload files. Type a path with slashes (css/style.css) to create folders at the same time.
Upload files accepts drag-and-drop of files and whole folders, up to 25 MB each in the browser. Larger files need Git on your computer (and very large ones Git LFS).
To edit, open a file and click the pencil icon. When you click Commit changes…, GitHub asks for a commit message and whether to commit directly to main or create a new branch and start a pull request.
A good commit message says what the change does in the imperative mood, under about 50 characters: “Add contact section”, “Fix typo in README”. An optional description underneath can explain why.
Step-by-step screens#
Drawings of github.com, the Git installer, VS Code and a terminal. GitHub changes its layout from time to time; the button names stay the same. The red numbers match the numbered actions under each picture; names on your computer will differ.
Loading pictures…
Code example: Good and bad commit messages#
✓ Add contact form to the home page
✓ Fix broken link to the CSS file
✓ Update README with setup steps
✗ update
✗ changes
✗ asdf
✗ Fixed stuff and also changed colours and added footer
Good messages make the history readable months later: git log --oneline becomes a list of what changed and when.
This example is illustrative. Copy or download it and run it in your own environment; the expected output is shown above.
Step-by-step explanation#
- Start with a verb: Add, Fix, Update, Remove.
- Describe one change per commit.
- Keep the first line short.
- Use the description for the why.
Real-world use case#
A teacher fixes a typo in the course notes from a phone during a break — no laptop, no Git install, still a proper commit.
Common mistakes#
Passwords and API keys in a public repository are found by bots within minutes. Never upload .env files.
Uploading a whole project as one commit loses history. Use Git locally for real projects.
Best practices#
- Small commits with clear messages
- Never upload secrets
- Use Git locally for bigger projects
- Preview Markdown before committing
Remember this#
Add file → Create / Upload.
Pencil = edit.
Every save is a commit with a message.
Practice exercise#
Your task: Write a good commit message for adding a footer with your email address.
Show solution
Add footer with contact email
Mini quiz#
Which commit message is best?
Want more? Practise all Git & GitHub MCQs · Git & GitHub interview questions
My notes#
Saved in this browser.