Summary - Pull request
- Git course
- Intermediate
- Lesson 52/82
- 5 min
Combine the PR flow to merge a branch into the main branch.
The complete pull request workflow
The pull request workflow allows changes from a working branch to be brought into the main branch in a controlled way. First push the branch to the remote repository, open a PR on GitHub, and submit the changes for review. Once the review is complete and the required approvals are obtained, the PR can be merged.
git push -u origin feature-login
# GitHub:
# New pull request
# Review changes
# Merge pull requestThis workflow helps teams develop code through review instead of pushing changes directly to the main branch.
Practice Complete the PR workflow
Push the feature-profile branch to the origin remote. Then write the lines identifying the source and target branches for opening a PR on GitHub. Also include the review decision and merge action.
Starter code
# Dalı uzak depoya gönder
# PR hedef dalı
# PR kaynak dalı
# İnceleme kararı
# Birleştirme işlemiSample solution
# Dalı uzak depoya gönder
git push -u origin feature-profile
# PR hedef dalı
Base: main
# PR kaynak dalı
Compare: feature-profile
# İnceleme kararı
Approve
# Birleştirme işlemi
Merge pull requestExpected output
Branch 'feature-profile' set up to track remote branch 'feature-profile' from 'origin'. Base: main Compare: feature-profile Approve Merge pull request
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which stage should happen before a PR is merged?
- Creating the GitHub account again
- Removing all commits from the local repository
- Reviewing and evaluating the changes Correct answer
- The source branch must be deleted
Explanation: Changes are reviewed and necessary corrections are made before merging a PR. Merging can proceed after the approval process is complete.
2 Merge the PR into the main branch
Base: main
Compare: feature-login
Review: Approve
Action: ____
Base: main
Compare: feature-login
Review: Approve
Action: Merge pull request
Explanation: After the review is complete, the Merge pull request action on GitHub merges changes from the source branch into the target branch.
3 Stages of the PR workflow
| Term | Meaning |
|---|---|
Push |
Push the working branch |
Open PR |
Create a merge proposal |
Review |
Review the changes |
Merge |
Bring changes into the target branch |