Explore the GitHub pull request process with our easy guide: learn branching, committing, reviewing, and merging code changes for collaborative development.
Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Understand the Concept of a Pull Request
A pull request (PR) is a mechanism for proposing, discussing, and collaborating on code changes in a Git repository hosted on GitHub. It allows contributors to submit changes, reviewers to provide feedback, and maintainers to merge the proposed changes into the main codebase.
Step 2: Prepare Your Local Environment
Before creating a pull request, you need a local copy of the repository:
# Clone the repository to your machine
git clone https://github.com/username/repository.git
# Change into the project directory
cd repository
username
and repository
with the actual GitHub account and repo name.
Step 3: Create and Switch to a New Branch
Working on a separate branch keeps your changes isolated from the main branch:
# Create and switch to a new feature branch
git checkout -b feature/my-new-feature
feature/login-form
or bugfix/navbar-alignment
.
Step 4: Make Changes and Commit Locally
Edit files in your favorite code editor. Once you’re satisfied, stage and commit your changes:
# Stage one file
git add path/to/file.ext
# Or stage all changed files
git add .
# Commit with a descriptive message
git commit -m "Add user authentication flow"
Step 5: Push Your Branch to GitHub
Send your branch to the remote repository so you can open a pull request:
# Push the branch and set upstream
git push -u origin feature/my-new-feature
-u
flag links your local branch to the remote branch.git push
without extra flags.
Step 6: Open the Pull Request on GitHub
main
or develop
) and your feature branch.#
and the issue number.
Step 7: Collaborate and Review
After opening the PR:
Step 8: Merge the Pull Request
Once everyone approves:
# You can merge via GitHub’s web interface:
# - Click “Merge pull request”
# - Choose “Squash and merge” or “Create a merge commit” as per the project’s guidelines
# - Confirm the merge
Step 9: Clean Up Your Local Environment
After merging, delete the branch locally and update your main branch:
# Switch to main branch
git checkout main
# Pull the latest changes
git pull origin main
# Delete the feature branch locally
git branch -d feature/my-new-feature
git push origin --delete feature/my-new-feature
.
You’ve now understood and executed a complete pull request workflow on GitHub!
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.