# Git Remote Collaboration Workflow

How a shared Git remote links your copy and a friend's: cloning, committing, pushing, pulling and merging changes between them\.

By brave\-moon\-3f907ee2

Topic: Computing, AI &amp; Electronics

[Open the interactive Jig](https://ask.jig.com/j/YGcti87EreBM)

## Transcript

### 1. One project, three copies

Git keeps a project's whole history as a chain of saved snapshots called commits\. In the middle sits the remote: a shared copy on a server that everyone can reach\. You and a friend each work on your own copy at your own desk\.

Git was started by Linus Torvalds in April 2005\. GitHub is just one place to host a remote\.

### 2. Clone: copy everything

To join in, you clone the remote\. Git copies every commit and the full history to your desk, and remembers the remote under the nickname origin\. It is a real copy, not a link, so you can work offline\.

### 3. Commit: save a snapshot

You change some files, then commit\. The new commit joins the end of your chain, linked to the one before it\. Nothing is sent anywhere yet: commits live only on your own copy\.

### 4. Push: share your work

Push uploads the commits the remote does not have yet\. Now the shared copy holds your snapshot too\. Pushing needs permission to write to that remote\.

### 5. Your friend joins in

Your friend pulls your commit down, adds a commit of their own and pushes it\. The remote moves ahead, but your copy does not change by itself\. Git never updates your desk until you ask\.

### 6. A push gets turned back

You make another commit and try to push\. The remote refuses, because it holds a commit you have never seen\. Git will not let you quietly overwrite your friend's work\.

Git calls this a rejected push\. The fix is always the same: get their work first\.

### 7. Pull: fetch, then merge

Pull is two moves in one\. Fetch downloads the new commit, then merge weaves both lines of work together with a merge commit that has two parents\. Your copy now contains everyone's work\.

Fetch alone is always safe: it downloads but never touches your files\.

### 8. Ask with a pull request

On many teams you push to a separate branch and open a pull request: a page asking others to review your work\. Your friend checks it and approves, then it is merged into main on the remote\.

### 9. Everyone in sync

Your friend pulls, and now all three copies hold the same history\. Clone once, then commit, pull and push again and again\. That loop lets many people build one project together\.

A remote does not have to be on the internet: it can be another computer, or even another folder\.
