The collaboration workflow
On a team, you rarely push straight to main. Instead you push a branch and open
a pull request (PR) — "here are my changes, please review and merge them".
It shows every commit, a line-by-line diff, and a discussion thread. The whole flow:
- Create a branch and commit your work.
- Push the branch to GitHub.
- Open a pull request.
- Teammates review and approve.
- Merge it into
main— done.
Let's do each step, both ways.
Step 1 — branch and commit
Work on a branch, not on main
$ git switch -c fix-typo
$ # edit files, then:
$ git add .
$ git commit -m "Fix typo in README" - Click the branch name in the status bar → Create new branch → name it
fix-typo - Edit, stage with +, type a message, click ✓ Commit
Step 2 — push the branch
Put the branch on GitHub
$ git push -u origin fix-typo - Click Publish Branch in the Source Control panel
The -u links your local branch to the GitHub one, so later pushes are just 'git push'.
Step 3 — open the pull request
Three doors to the same room — pick whichever you have open:
Open the PR
$ gh pr create --fill # uses your branch's commits for title/description
$ gh pr status # see your open PRs
$ gh pr checkout 42 # try someone else's PR locally - On github.com, a Compare & pull request banner appears right after the push — click it
- Or in VS Code with the GitHub Pull Requests extension: the Create Pull Request view opens after publishing
- Add a title and description, then Create pull request
A good PR description explains what changed and why — it makes review faster. Run gh auth login once to connect the CLI.
Step 4 — review, update, merge
Reviewers leave comments, request changes, or approve. Need to fix something? Just push more commits to the same branch — the PR updates automatically. Once approved, click Merge pull request on GitHub, then Delete branch to keep the repo tidy. Last step: bring your own computer up to date.
After the merge: tidy up locally
$ git switch main
$ git pull
$ git branch -d fix-typo - Status bar → switch to main
- Click Sync Changes
- Branch picker → Delete Branch… → fix-typo
-d only deletes branches whose work is already merged — it's safe.
Issues: GitHub Issues are a to-do list for a project — bug reports, feature ideas, questions. PRs can reference an issue (e.g. "Closes #42") to auto-close it when merged.
The green ✓ — checks and Actions in 60 seconds
Next to your PR you'll often see a green check ✓ or a red ✗. That's GitHub
Actions — automation the project set up so GitHub runs tasks on every push, like
"run the tests" or "build the site". This is what people mean by CI
(continuous integration). The recipes live in small YAML files under
.github/workflows/, and the Actions tab shows every run. You
don't need to write one on day one — just know that a red ✗ means a check failed, and
clicking it shows exactly why.
Project hygiene: a healthy repo has a README.md (what it is, how to run it), a LICENSE (how others may use it) and a .gitignore. GitHub shows the README right on the repo's home page.
Up next: contributing to a project you don't own — forks, and keeping yours in sync.