This guide simplifies the GitHub Pull Request (PR) process for making contributions to a repository. Follow these steps to create, submit, and manage your pull requests.
- Create a new branch based on the latest code in 'main.'
- Use a lowercase, hyphen-separated name for your branch.
git checkout main
git pull
git checkout -b your-branch-name
- Each commit should be self-contained with a descriptive message.
- Ensure code follows style rules.
- Test changes locally.
git add .
git commit -m "Your commit message here"
- Do manual testing to confirm your changes.
- Use
git diff
to check your changes.
git push origin your-branch-name
-
Go to your fork on GitHub.
-
Select your branch from the dropdown menu.
-
Click "pull request."
-
Ensure the base repository and base branch are correct.
-
The head repository should be your fork, and the head branch should be your branch.
-
If you don't see the repository, click the link to
compare across forks
.On this page, carefully review your commits and changes to ensure accuracy (e.g., check for missing newlines, omitted files).
-
Click "Create pull request."
- Make changes based on reviewer feedback.
- Keep your commits logical and well-structured.
- Do not force-push or rebase your PR.
Use 'Start a review' for draft comments. Address comments and test changes locally.
- Once your PR is merged, delete the feature branch.
git branch -d your-branch-name
git push origin --delete your-branch-name