PR flow
- Git course
- Intermediate
- Lesson 76/82
- 5 min
Push the branch and set up the PR opening flow.
Pull request workflow from a branch
Changes completed on a feature branch are first pushed to the remote repository. Then, a pull request is opened on GitHub to request merging that branch into the main branch. Team members review the changes and add comments when necessary.
git push -u origin feature/user-login
# Open a pull request on GitHubPull request review process
A pull request allows changes to be reviewed before they are added to the main branch. Reviewers can add line comments, request changes, or approve the PR. Necessary corrections can be made by pushing new commits to the same feature branch.
Push feature branch
↓
Open pull request
↓
Review changes
↓
ApprovePractice Push a branch for a PR
Push the feature/report-page branch to the origin remote while establishing an upstream relationship. Then print a message indicating that a pull request will be opened.
Starter code
# Özellik dalını gönder
# PR mesajını yazdırSample solution
git push -u origin feature/report-page
print("Pull request ready for review")Expected output
Branch pushed successfully. Pull request ready for review
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the next main step after pushing a feature branch to the remote repository?
- Open a pull request Correct answer
- Delete the main branch
- Reset the entire commit history
- Delete the local repository
Explanation: After the branch is pushed to the remote repository, a pull request is opened to submit the changes for review.
2 Push the feature branch
git push -u origin ____
git push -u origin feature/user-login
Explanation: On the first push to the remote repository, the -u option establishes an upstream tracking relationship.
3 Operations in the PR process
| Term | Meaning |
|---|---|
Push |
Sending a branch to remote |
Pull request |
Opening a merge request |
Review |
Reviewing code changes |
Approve |
Approving changes |