Creating a New File
Create a file directly in your repository.
- On the repository page, click Add file → Create new file
- Enter the file name:
notes.md - Write the content:
# Study Notes
## What I Learned Today
- Creating a GitHub repository
- Writing a README
- Committing files
## Up Next
- Branches
- Pull Requests
- In the Commit changes section below:
- Commit message:
docs: add study notes file - Select Commit directly to the
mainbranch
- Commit message:
- Click Commit new file
Editing a File
You can also edit existing files.
- Click the
notes.mdfile - Click the pencil icon
- Make your edits
- Save with Commit changes
Viewing Commit History
Every change is recorded. Take a look.
- On the repository main page, click the N commits link (above the file list)
- Click any commit to see what changed
Green lines (+): Added content
Red lines (-): Removed content
This is called a diff.
"Why?" — Why Good Commit Messages Matter
Commit messages are letters to your future self and your teammates. Six months later, when you search "why did I change this file?", the commit message has the answer.
Bad commit messages:
fix
asdf
update
Good commit messages:
docs: add installation instructions to README
fix: resolve login button click error
feat: add dark mode feature
Tips for writing commit messages:
- Be clear about what you did (save "why" for the body if needed)
- Start with a present-tense verb: "add", "fix", "remove"
- Keep it concise (50 characters or fewer recommended)
Many teams use type prefixes like feat:, fix:, docs: (Conventional Commits). Consistency makes the history much easier to read.
Deep Dive
Deleting a File
You can delete files on the GitHub web interface:
- Open the file you want to delete
- Click
···(More options) or the trash icon in the top-right - Select Delete file
- Enter a commit message and commit
Deletions are recorded as commits too. You can restore a previous state from the history at any time.
Uploading Files
You can upload local files to GitHub without a terminal:
- Click Add file → Upload files
- Drag and drop files or click choose your files
- Write a commit message
- Click Commit changes
You can upload multiple files at once. However, you need to set up folder structures manually.
- Create a new
notes.mdfile in your repository and write down what you learned today. - Edit
notes.mdto create a second commit. - Check the commit history and view the diff.
Q1. What is a commit?
- A) Deleting a repository
- B) Saving file changes and leaving a message describing them
- C) Copying code from another repository
- D) Sending a notification to teammates