SkillNavora
Git & GitHub Complete Guide › Lesson 5 of 8 · about 25 minutes
Lesson 5

GitHub collaboration: remotes, push and pull, forks, pull requests, reviews and issues

Connect a local repository to GitHub, push, fetch and pull with real output, contribute through forks and pull requests, review code, track work with issues and Projects, and protect main with rulesets.

Checked against official sources in November 2026. Lessons build on each other.
In plain words. GitHub is the shared office. Push is taking your finished pages to the office; fetch is checking what colleagues left; a pull request is asking "please review my pages before we put them in the master copy".

Key ideas

Remote / originA named link to the GitHub copy of your repository.
push / fetch / pullSend commits up; download others' commits; download and merge into your branch.
ForkYour own copy of someone else's repository, used to propose changes to projects you cannot write to.
Pull request (PR)A request to merge one branch into another, with discussion, reviews and checks.
IssueA tracked task, bug or idea, which a PR can close ("Fixes #12").
Ruleset / branch protectionRules such as "main needs one approving review and passing checks".

How it works

1. Push to GitHub

After creating an empty repository on GitHub, add it as origin and push. A local bare repository stands in for GitHub here so you can see real output; with GitHub the URL looks like [email protected]:you/notes.git.

Real terminal output (captured when this guide was built)
$ git remote add origin ../github/notes.git
$ git remote -v
origin	../github/notes.git (fetch)
origin	../github/notes.git (push)
$ git push -u origin main
branch 'main' set up to track 'origin/main'.
To ../github/notes.git
 * [new branch]      main -> main
$ git branch -vv
* main 209b3bc [origin/main] Add glossary

2. Get a teammate's work: fetch, then pull

Real terminal output (captured when this guide was built)
$ git clone -q github/notes.git ravi && echo cloned
cloned
$ git config user.name "Ravi Teammate" && git config user.email [email protected] && echo 'Q3: What is a remote?' >> quiz.md && git commit -q -am "Add quiz question 3" && git push -q && git log --oneline -1
addeeb7 Add quiz question 3
$ git fetch
From ../github/notes
   209b3bc..addeeb7  main       -> origin/main
$ git status -sb
## main...origin/main [behind 1]
$ git log --oneline main..origin/main
addeeb7 Add quiz question 3
$ git pull --ff-only
Updating 209b3bc..addeeb7
Fast-forward
 quiz.md | 1 +
 1 file changed, 1 insertion(+)

git fetch downloads safely without changing your files; git status -sb shows you are behind; git pull --ff-only updates only if no merge is needed, which avoids surprise merge commits.

3. The pull request workflow

  1. Create a branch: git switch -c fix/typo-in-readme.
  2. Commit your change and push the branch: git push -u origin fix/typo-in-readme.
  3. On GitHub select Compare & pull request (or run gh pr create --fill). Write what changed, why, and how you tested it. Link the issue with Fixes #12.
  4. Reviewers comment line by line, suggest changes, then Approve or Request changes. Automated checks (GitHub Actions) run on every push.
  5. Push more commits to the same branch to address feedback; the PR updates automatically.
  6. Merge with the method your team uses, delete the branch, and run git switch main && git pull.

4. Contribute to someone else's project

  1. Select Fork on the project's GitHub page to make your copy.
  2. Clone your fork, and add the original as upstream: git remote add upstream https://github.com/owner/project.git.
  3. Keep in sync: git fetch upstream then git merge upstream/main (or use Sync fork on GitHub).
  4. Branch, commit, push to your fork, and open a pull request to the original repository. Read its CONTRIBUTING.md first.

5. Good reviews and good pull requests

AuthorReviewer
Small PRs (under ~300 lines changed) with a clear titleReview within a day; start with the description and tests
Explain why, link the issue, add screenshots for UIAsk questions rather than demand; separate must-fix from nice-to-have
Run tests and lint before askingUse suggested changes for small fixes the author can accept in one click

6. Issues, Projects and protecting main

  • Issues: one per bug or task, with labels (bug, enhancement, good first issue) and an assignee. Templates help reporters give the right details.
  • Projects: boards and tables that track issues and PRs across repositories, with custom fields such as priority and sprint.
  • Rulesets (Settings › Rules › Rulesets) or branch protection: require pull requests, at least one approval, passing status checks and no force pushes on main.
  • CODEOWNERS: a file that automatically requests reviews from the right people for each folder.

Common mistakes and fixes

MistakeFix
git pull creating messy merge commitsFetch first, or use git pull --ff-only; rebase your own branch on main when needed.
Huge pull requestsSplit work into small PRs that each do one thing.
Pushing directly to mainProtect main with a ruleset that requires pull requests and checks.

Practice

  1. Push a project to GitHub and open a pull request from a branch, even if you review it yourself.
  2. Fork a public repository, sync it with upstream, and open a small documentation PR.
  3. Create a ruleset on your own repository that requires a pull request for main.

Quick check

What is the difference between fetch and pull?

fetch downloads commits without changing your files; pull fetches and then merges (or rebases) into your branch.

Why add an upstream remote to a fork?

To fetch new commits from the original project and keep your fork in sync.

What does "Fixes #12" in a PR description do?

It links the PR to issue 12 and closes the issue when the PR is merged into the default branch.

Go further (official sources)

Refer & earn