0
0
Gitdevops~10 mins

Pull request process in Git - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Pull request process
Developer creates feature branch
Developer makes changes and commits
Developer pushes branch to remote
Developer opens Pull Request (PR)
Team reviews PR
Approve
Merge PR
Feature merged into main branch
This flow shows how a developer creates a branch, makes changes, pushes it, opens a pull request, gets review feedback, and finally merges the changes.
Execution Sample
Git
git checkout -b feature-branch
# make changes
git add .
git commit -m "Add new feature"
git push origin feature-branch
# open PR on GitHub
# after approval:
# merge PR on GitHub
git checkout main
git pull
This sequence shows the main git commands used during the pull request process.
Process Table
StepActionCommand/OperationResult/State Change
1Create new branchgit checkout -b feature-branchNew branch 'feature-branch' created and switched to
2Make code changesedit filesWorking directory updated with new changes
3Stage changesgit add .Changes staged for commit
4Commit changesgit commit -m "Add new feature"New commit created on 'feature-branch'
5Push branchgit push origin feature-branchBranch pushed to remote repository
6Open Pull RequestOpen PR on GitHubPR created for 'feature-branch' to merge into 'main'
7Review PRTeam reviews codePR approved or changes requested
8If changes requestedDeveloper updates branchNew commits added to 'feature-branch'
9Merge PRMerge PR on GitHubChanges merged into 'main' branch
10Update local maingit checkout main && git pullLocal 'main' updated with merged changes
11ExitProcess completeFeature integrated into main branch
💡 Process stops after PR is merged and local main branch is updated
Status Tracker
VariableStartAfter Step 1After Step 4After Step 5After Step 9Final
branchmainfeature-branchfeature-branchfeature-branch (remote)feature-branchmain
commit historymain commits onlymain commits + new commits on feature-branchsamesamemain + feature commits mergedmain + feature commits merged
PR statusnonenonenonenonemergedmerged
Key Moments - 3 Insights
Why do we create a new branch instead of working directly on main?
Creating a new branch isolates your changes so the main branch stays stable. Execution table step 1 shows branch creation before changes.
What happens if the team requests changes during review?
You update your branch with new commits (step 8), then the PR updates automatically for re-review.
Why do we pull the main branch after merging the PR?
To update your local main branch with the merged changes from remote, as shown in step 10.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the state of the 'branch' variable after step 5?
Afeature-branch deleted
Bmain branch active locally
Cfeature-branch pushed to remote
Dmain branch merged
💡 Hint
Check variable_tracker column 'After Step 5' for 'branch'
At which step does the pull request get merged into the main branch?
AStep 9
BStep 7
CStep 10
DStep 11
💡 Hint
Look at execution_table row with 'Merge PR' action
If the developer skips pushing the branch (step 5), what will happen when opening the PR (step 6)?
APR opens normally with local branch
BPR cannot be created because remote branch does not exist
CPR merges automatically
DPR is created but cannot be reviewed
💡 Hint
Refer to execution_table step 5 and 6 relationship
Concept Snapshot
Pull Request Process Cheat Sheet:
- Create a feature branch: git checkout -b feature-branch
- Make changes, stage and commit: git add . && git commit -m "msg"
- Push branch to remote: git push origin feature-branch
- Open PR on remote platform (GitHub/GitLab)
- Team reviews and approves or requests changes
- Merge PR after approval
- Update local main branch: git checkout main && git pull
Full Transcript
The pull request process starts with creating a new branch to keep changes separate from the main code. Developers make changes and commit them on this branch. Then they push the branch to the remote repository. Next, they open a pull request on a platform like GitHub to ask the team to review the changes. The team reviews and either approves or requests changes. If changes are requested, the developer updates the branch with new commits. Once approved, the pull request is merged into the main branch. Finally, the developer updates their local main branch to include the merged changes. This process helps keep the main code stable and allows team collaboration.