CodeBlanks Logo Icon CodeBlanks

PR flow

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/api

Practice 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

terminal
# Özellik dalını gönder

# Ana dala geç

Sample solution

terminal
git push -u origin feature/dashboard-api
git switch main

Expected 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

terminal
# Özellik dalını birleştir

# Yerel dalı sil

Sample solution

terminal
git merge feature/dashboard-api
git branch -d feature/dashboard-api

Expected 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

Question
git push -u origin ____
Answer
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

All lessons in Intermediate

20 Intermediate final

  1. Branch management
  2. Rebase
  3. Conflict
  4. PR flow