Merges, Pull Requests, and Remote Branches

Summary

This note explains what happens after work is done on a branch: how changes are merged, how pull requests fit into the workflow, and how remote branches relate to your local ones. This is the point where individual Git work turns into collaboration or at least into a cleaner review process.

Why this matters

  • most real Git workflows do not end at git commit
  • merges and pull requests are how work is reviewed, integrated, and shared
  • remote branches are often where confusion starts if the local and remote mental model is weak

Environment / Scope

ItemValue
TopicGit collaboration model
Best use for this noteunderstanding branch integration
Main focusmerge, pull request, local vs remote branch
Safe to practise?yes, in a throwaway repo

Key concepts

  • Merge - combining changes from one branch into another
  • Pull request - a review and merge workflow around branch changes, usually on GitHub
  • Local branch - a branch that exists in your local repository
  • Remote branch - a branch that exists on the remote repository
  • Tracking branch - a local branch associated with a specific remote branch

Mental model

Think about this flow:

local feature branch
-> push to remote feature branch
-> open pull request
-> review and merge into main

This means:

  1. you do work locally on a branch
  2. you push that branch to the remote
  3. the pull request represents discussion and review
  4. merging brings the work into the target branch, usually main

Everyday workflow

StepTypical command or actionMeaning
Push feature branchgit push -u origin feature-xcreate or update the remote branch
Open PRGitHub UIrequest review and propose merge
Update branchgit pushsend more commits to the same branch
MergeGitHub UI or git mergeintegrate branch work
Clean updelete branchremove no-longer-needed branch after merge

Common misunderstandings

MisunderstandingBetter explanation
”A pull request is the merge”the PR is the review process around the proposed merge
”Pushing a branch means it is already in main”pushing only updates the remote branch, not the target branch
”Remote branch and local branch are the same thing”they are related, but they are still separate states
”Merge problems mean Git is broken”often it just means the histories changed in parallel and need reconciliation

Verification

CheckExpected result
git branchshows your local branches
git branch -rshows remote branches
git statusshows current branch and tracking info
git log --oneline --graph --allshows how branches relate in history

Pitfalls / Troubleshooting

ProblemLikely causeWhat to check
Branch exists locally but not remotelynot pushed yetgit push -u origin ...
PR does not include expected commitswrong branch or missing pushcurrent branch, remote branch, recent commits
Merge is confusingweak branch history mental modelgit log --oneline --graph --all
Old branches pile upno cleanup habitbranches after merge

Practical rule

A pull request is usually easier to understand if you think of it as “please review this branch before it becomes part of main”.

Key takeaways

  • merge is about integrating branch history
  • a pull request is the workflow around review and integration
  • local and remote branches are related, but they are not the same thing