PR flow
- Git course
- Intermediate
- Lesson 82/82
- 6 min
Set up the push, PR and merge flow.
Team collaboration with pull requests
In a pull request workflow, the developer first pushes the feature branch to the remote repository. Then a PR targeting the main branch is opened on GitHub, and the developer waits for team review. Approved changes are merged into the main branch, completing development in a controlled way.
git push -u origin feature/api
# Open a PR on GitHub
# Review and approval
git switch main
git merge feature/apiPractice Push the PR branch and switch to main
Push the feature/dashboard-api branch to origin with an upstream relationship. Then switch to the main branch. Write the two commands in order.
Starter code
# Özellik dalını gönder
# Ana dala geçSample solution
git push -u origin feature/dashboard-api
git switch mainExpected output
Branch pushed successfully. Switched to branch 'main'.
Practice Merge approved PR changes
The PR review is complete and the feature/dashboard-api branch has been approved. While on main, merge the feature branch. Then safely delete the local feature/dashboard-api branch.
Starter code
# Özellik dalını birleştir
# Yerel dalı silSample solution
git merge feature/dashboard-api
git branch -d feature/dashboard-apiExpected output
Feature branch merged. Deleted branch feature/dashboard-api.
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which operation brings changes into main after a PR is approved?
- git restore
- git reflog
- git stash
- git merge Correct answer
Explanation: After the PR is approved, the feature branch is merged into main to transfer the changes.
2 Push the feature branch for a PR
git push -u origin ____
git push -u origin feature/api
Explanation: The feature branch is pushed to origin so that a PR can be opened on GitHub.
3 PR completion workflow
| Term | Meaning |
|---|---|
Özellik dalı |
Contains task changes |
Uzak push |
Sending the branch to GitHub |
PR onayı |
Acceptance of the review |
Merge |
Integrating approved changes |