Working with people, anywhere

Collaboration

You want to work on the same files as someone far away โ€” different house, different city, not on your Wi-Fi. Good news: this is a solved problem. For code and text, the best tool is Git + GitHub. This page explains why, shows the mental model, and walks you through it step-by-step in VS Code โ€” plus the alternatives for live pairing and documents.

Git GitHub VS Code Live Share
Start here

First, pick the right tool for the job

"Collaborating on files" can mean different things. The best tool depends on what you're sharing and how you work together.

What are you sharing? ๐Ÿ’ป Code / textโ†’ Git + GitHub โญ ๐Ÿ“„ Documents / mediaโ†’ Google Drive / Dropbox ๐Ÿ‘ฅ Editing together liveโ†’ VS Code Live Share this page's main focus โ†’
โญ

The short answer

If you're working on a project of code or text files in VS Code โ€” which is exactly your case โ€” Git + GitHub is the best way. It's the worldwide standard, it's free, it works over the internet from anywhere, and it never loses your work. The rest of this page teaches it.


The idea

Why Git + GitHub?

They're two different things that work together:

๐ŸŒฟ

Git โ€” the version control system

A tool on your computer that tracks every change to your files as a series of save-points ("commits"). You can see history, undo, and โ€” crucially โ€” merge changes from two people cleanly.

โ˜๏ธ

GitHub โ€” the shared home online

A website that hosts your Git project in the cloud so others can reach it from anywhere. Think of it as the central meeting point your files sync through.

Together they solve the exact problem you described. You don't email files back and forth or worry about being on the same network โ€” you both sync through GitHub over the internet, and Git makes sure nobody's work gets overwritten.

  • Works from anywhere โ€” any internet connection, any distance. No shared Wi-Fi needed.
  • Full history & undo โ€” every version is saved; you can always go back.
  • No overwrites โ€” Git merges two people's edits instead of clobbering one.
  • Async-friendly โ€” you each work whenever suits you; no need to be online at the same time.
  • Free & built into VS Code โ€” private repos are free, and VS Code has the buttons built in.

Picture it

The mental model: a hub in the cloud

This is the one diagram to hold in your head. You each keep a full copy of the project on your own machine. GitHub sits in the middle as the shared hub. You push your changes up to it and pull your collaborator's changes down.

โ˜๏ธ GitHub โ€” the shared hub ๐Ÿ’ป You your full copy (local repo) ๐Ÿง‘โ€๐Ÿ’ป Collaborator their full copy (far away) push โ†‘ โ†“ pull โ†‘ push pull โ†“

Nobody edits the same live file at once โ€” you each edit your own copy, then sync through GitHub.

๐Ÿ”‘

Four verbs are all you really need

Clone (get a copy) ยท Commit (save a checkpoint) ยท Push (send yours up) ยท Pull (bring theirs down). Master these and you can collaborate. Everything else is refinement.


One time only

Setup (about 10 minutes)

You only do this once per computer. Your collaborator does the same on theirs.

Create a free GitHub account

Go to github.com and sign up. Your collaborator needs an account too so you can invite them.

Install Git

Download it from git-scm.com (Windows/Mac/Linux). Accept the defaults. This is the engine VS Code drives under the hood.

Install VS Code + the GitHub extension

You already have VS Code. Add the "GitHub Pull Requests" extension from the Extensions panel โ€” it lets you sign in to GitHub and handle reviews without leaving the editor.

Tell Git who you are

Once, in a terminal, so your commits are labelled correctly:

git config --global user.name "Your Name" git config --global user.email "you@example.com"

Use the same email as your GitHub account. In VS Code, run this in the built-in terminal (View โ†’ Terminal).


The daily rhythm

The core workflow

Here's the loop you'll repeat forever. Each step shows the button in VS Code and the command it runs underneath (you can use either โ€” the buttons are enough).

StepWhat it meansIn VS CodeCommand
1. CloneDownload a copy of the project from GitHub to your machineSource Control โ†’ Clone Repositorygit clone <url>
2. EditChange files as normalJust type in the editorโ€”
3. StagePick which changes go in the next save-pointClick + next to a filegit add <file>
4. CommitSave a labelled checkpoint locallyType a message โ†’ โœ“ Commitgit commit -m "msg"
5. PushSend your commits up to GitHubSync Changes / Pushgit push
6. PullBring your collaborator's new commits downSync Changes / Pullgit pull
โœ๏ธ Edit โž• Stage ๐Ÿ’พ Commit โฌ†๏ธ Push โฌ‡๏ธ Pull repeat every work session
๐ŸŒ…

Golden habit

Pull before you start, push when you finish. Pulling first means you build on your collaborator's latest work; pushing at the end shares yours. This one habit prevents most collaboration headaches.


The real thing

Working together without stepping on each other

If you both edit the main version at once, you can clash. The professional pattern avoids that with branches and pull requests โ€” and it's how essentially every software team works.

๐ŸŒฟ A branch

A private line of work split off from main. You make your changes there without disturbing the shared version. Your collaborator works on their own branch.

๐Ÿ”€ A pull request (PR)

When your branch is ready, you open a PR on GitHub: "please merge my branch into main." Your collaborator can review it, comment, and approve โ€” then it merges.

main (the shared version) merged โœ“ commit commit your branch: add-login ๐Ÿ”€ Pull Request โ†’ review

Branch off main, commit freely, then merge back through a reviewed pull request.

A complete walkthrough: you + a friend

You create the repo & invite them

On GitHub, create a new repository (make it Private). Open Settings โ†’ Collaborators โ†’ Add people and enter your friend's GitHub username. They get an invite email.

Both clone it

Each of you runs git clone <url> (or VS Code's Clone Repository). Now you both have a full local copy.

Make a branch for your task

Before editing: git checkout -b add-login. Your friend does the same with their own name, e.g. git checkout -b fix-header.

Work, commit, push your branch

Edit โ†’ commit โ†’ git push -u origin add-login. Your branch now lives on GitHub, separate from main.

Open a pull request

GitHub shows a "Compare & pull request" button. Open it, describe your change, and request your friend as reviewer.

Review, approve, merge

Your friend reads the diff, comments if needed, approves, and clicks Merge. Your work is now part of main.

Everyone pulls main

Both of you run git checkout main then git pull to get the newly merged work. Repeat from step 3 for the next task.


No command line needed

Doing it all inside VS Code

VS Code has Git built in, so you can do everything above with buttons. The Source Control panel (the branch icon in the left bar, or Ctrl+Shift+G) is your home base.

  • ๐Ÿ“ฅClone: Command Palette (Ctrl+Shift+P) โ†’ Git: Clone, paste the GitHub URL.
  • ๐ŸŒฟNew branch: click the branch name in the bottom-left status bar โ†’ Create new branch.
  • โž•Stage & commit: in Source Control, hover a file and click +, type a message, click โœ“ Commit.
  • ๐Ÿ”„Sync: the Sync Changes button pushes your commits and pulls theirs in one click.
  • ๐Ÿ”€Pull requests: the GitHub extension adds a Pull Requests view to create, review, and merge PRs without leaving the editor.
Source Control
Changes
auth.tsM +
login.cssU +
Add login form validation
โœ“ Commit
๐Ÿ”„ Sync Changes โ†‘2 โ†“1

Don't panic

Merge conflicts, demystified

A merge conflict happens only when you and your collaborator change the same lines of the same file. Git can't guess who's right, so it asks you. It's normal and fixable โ€” not a disaster.

Git marks the clash right in the file like this:

<<<<<<< HEAD const title = "Welcome back"; # your version ======= const title = "Hello again"; # their version >>>>>>> fix-header

To resolve it, you just decide what the final lines should be and delete the <<<, ===, >>> markers. VS Code makes this a click:

  • ๐ŸŸฉIt shows buttons above the conflict: Accept Current, Accept Incoming, Accept Both, or Compare.
  • โœ๏ธOr edit the lines by hand to blend both. Then stage the file and commit โ€” conflict resolved.
๐Ÿ›ก๏ธ

How to avoid most conflicts

Pull often, keep branches short-lived, and โ€” where you can โ€” agree who owns which files. Conflicts shrink to almost nothing when you sync frequently instead of hoarding changes for days.


The real-time option

Want to edit together live? Use Live Share

Git is asynchronous โ€” great for working on your own schedule. But sometimes you want to sit "shoulder to shoulder" in the same file at the same time, like Google Docs for code. That's VS Code Live Share.

๐Ÿ‘ฅ

What it does

Install the Live Share extension, click Share, and send the link. Your collaborator sees your project, your cursors move together, and you can even share a terminal and a running server โ€” no setup on their end.

โš–๏ธ

The trade-off

It's a live session, not permanent storage. When it ends, the shared view goes away. Use it alongside Git: Live Share for pairing in the moment, GitHub for saving and syncing the actual work.

๐Ÿค

Best of both

Many people pair over Live Share to solve a tricky bit together, then whoever's hosting commits and pushes to GitHub so the result is saved for everyone. They're partners, not rivals.


The full picture

All the options compared

ToolBest forStyleVerdict for you
Git + GitHubCode & text projectsAsync, versionedโญ The recommended choice โ€” exactly your use case.
VS Code Live ShareLive pair programmingReal-timeGreat add-on for working together in the moment.
GitHub CodespacesA shared cloud dev machineCloud IDEHandy if setups differ; builds on GitHub.
Google Drive / DropboxDocuments, images, mediaFile syncFine for non-code files; poor for code (no real merging).
OneDriveOffice docs on WindowsFile syncSame as above โ€” not for a code project.
Email / USB / chatOne-off single filesManualโŒ Avoid for anything ongoing โ€” versions get lost.

Good habits

Safety & good habits

โœ“ Do

  • โœ“Use a .gitignore to keep junk and secrets out of the repo (e.g. node_modules/, .env).
  • โœ“Write clear commit messages โ€” "Fix login redirect", not "stuff".
  • โœ“Pull before you start, push when you finish.
  • โœ“Keep private repos private until you intend to share publicly.

โœ— Avoid

  • โœ—Never commit passwords, API keys, or tokens. Once pushed, treat them as leaked.
  • โœ—Don't commit huge binaries (videos, big datasets) โ€” Git handles text, not gigabytes.
  • โœ—Don't force-push shared branches โ€” it can erase a collaborator's work.
๐Ÿ”‘

A note on sign-in

GitHub sign-in and any credentials are things you should enter yourself in your browser or VS Code โ€” never paste tokens into files or share them in chat. If you get stuck on authentication, GitHub's own docs walk you through it safely.


Keep this handy

Command cheat sheet

The buttons in VS Code cover all of these โ€” but here's what runs underneath, for when you want the terminal.

# one-time per project git clone <url> # get your own copy from GitHub # the everyday loop git pull # bring down the latest before you start git checkout -b my-feature # start a branch for your task git add . # stage all your changes git commit -m "What I did" # save a checkpoint git push -u origin my-feature # send your branch to GitHub # then open a Pull Request on github.com, get it reviewed & merged # helpful anytime git status # what's changed? git log --oneline # history of commits git checkout main && git pull # get back to the latest shared version
Your first move

Try it in 15 minutes

Create a free GitHub account, make a private test repo, invite your collaborator, and both clone it in VS Code. Push one small change each and watch it appear on the other side. That single loop is remote collaboration โ€” everything else builds on it.