How to Use Pull Requests in a Solo GitHub Repo
In this article
Pull requests are usually thought of as a team feature, but they work brilliantly for solo projects too. Using pull requests in your own GitHub repository gives you a checkpoint between your working code and your main branch, a built-in code review process, and a clear history of changes. This guide walks through the entire flow: creating a branch, making changes, opening a pull request, merging it, and cleaning up—all by yourself.
What You'll Need
- A GitHub account and a repository you own (public or private).
- Git installed on your computer, or you can use the GitHub web interface directly.
- Basic familiarity with the command line if you choose the local Git route.
Step-by-Step
- Create a new branch. Before making any changes, create a branch off your main branch. In your terminal, run
git checkout -b feature/my-change(replace the name with something descriptive). If you're working entirely on GitHub, click the branch dropdown at the top of the file list, type a new branch name, and press Enter. - Make your changes. Edit files, add new ones, or delete old ones. On your local machine, use your editor. On GitHub, you can edit files directly in the branch by navigating to the file and clicking the pencil icon.
- Commit your changes. Stage and commit with a clear message. Locally:
git add .thengit commit -m "Describe what you changed". On the web, scroll to the bottom of the edit page, write a commit message, and choose "Commit directly to thebranch." - Push the branch to GitHub. If working locally, run
git push -u origin feature/my-change. This uploads your branch to GitHub. If you edited on the web, this step is done. - Open a pull request. Go to your repository on GitHub. You'll see a yellow banner suggesting your branch—click "Compare & pull request." If not, click "Pull requests" tab, then "New pull request." Select your branch as the "compare" branch and your main branch as the "base."
- Fill in the PR details. Write a title and a description. Even though you're the only reviewer, describe what you did and why. This becomes part of your project history. You can also assign yourself, add labels, or link issues.
- Review your own changes. Scroll through the "Files changed" tab. Check for mistakes, leftover debug code, or unintended changes. This is the main benefit of a solo PR—a second look at your own work.
- Merge the pull request. When you're satisfied, click "Merge pull request." Choose a merge method: "Create a merge commit" keeps all commits, "Squash and merge" combines them into one, "Rebase and merge" re-applies commits linearly. For solo work, squash and merge often keeps history clean.
- Delete the branch. After merging, GitHub offers a "Delete branch" button. Click it. If you're local, run
git branch -d feature/my-changeandgit pullto update your main.
Common Mistakes
- Forgetting to pull before creating a new branch. If your local main is behind GitHub, you'll start from an outdated point. Always
git pullfirst. - Opening a PR from main to main. This creates an empty PR. Make sure you're comparing a feature branch to main.
- Merging without reviewing. The review step is the whole point. Even a quick scroll catches typos and logic errors.
- Leaving branches around. Stale branches clutter the repo. Delete them after merging.
- Writing vague commit messages. "Update file" is not helpful. Use messages that explain the change, like "Fix typo in installation instructions."
Tips
- Use a consistent branch naming convention. For example,
feature/,bugfix/, ordocs/. This makes it clear what each branch is for. - Keep PRs small. A single logical change per PR is easier to review and revert if needed.
- Use the PR description as a changelog. Write what you changed and why. Future you will thank you.
- Enable auto-merge (optional). If you're confident, you can set the PR to auto-merge when checks pass. But for solo work, manual merge is fine.
- Use draft PRs for work in progress. If you're not ready to merge, open a draft PR to track progress and get comments later.
- Take advantage of GitHub's web editor for small fixes. You can make a quick change, commit to a new branch, and open a PR all in the browser.
Troubleshooting
- "This branch has conflicts that must be resolved." This happens when your branch and main have different changes to the same lines. On GitHub, click "Resolve conflicts" and edit the file to keep the correct lines. Then commit the resolution. Locally, you can run
git merge mainwhile on your feature branch, fix conflicts, and push. - "No new commits" or "Nothing to compare." Your branch is likely identical to main. Check that you actually committed and pushed. Also verify you selected the correct branches in the PR.
- Pull request shows changes you didn't make. This can happen if you branched off an old version of main. Rebase your branch onto the latest main:
git fetch origin, thengit rebase origin/main. Force push if needed (git push --force-with-lease). - You accidentally merged the wrong branch. If you haven't pushed the merge commit, you can reset locally:
git reset --hard HEAD~1. If you already pushed, you can revert the merge withgit revert -m 1, but this creates a new commit. For solo repos, you can also force push the main branch back, but be careful—this rewrites history. - Cannot delete a branch on GitHub. You can only delete a branch after it's merged (or if you close the PR). If the PR is still open, close it first.
Frequently Asked Questions
Why should I use pull requests if I'm the only developer?
They provide a mandatory review step, a clear history of changes, and a way to test changes before they hit your main branch. It also mimics a team workflow, which is useful if you later collaborate.
Can I use pull requests entirely in the browser?
Yes. You can create branches, edit files, commit, open a PR, and merge—all from GitHub's web interface. No local Git needed.
What's the difference between merge, squash, and rebase?
Merge creates a new commit that joins histories. Squash combines all commits into one. Rebase re-applies your commits on top of main, creating a linear history. For solo work, squash is often cleanest.
Should I delete the branch after merging?
Yes. It keeps the repository tidy. GitHub makes it a one-click action. You can always recreate it later if needed.
How do I update my local main after merging?
Run git checkout main then git pull. This fetches the merged changes from GitHub.
Can I reopen a closed pull request?
Yes, you can reopen a closed PR as long as the branch still exists. If you deleted the branch, you'll need to recreate it from the merge commit.