# Local vs Remote

### Local vs Remote repositories

| Local Repository              | Remote Repository                 |
| ----------------------------- | --------------------------------- |
| Lives on your computer        | Lives on a server (e.g. GitHub)   |
| Stores commits and branches   | Stores shared project history     |
| Works offline                 | Requires internet                 |
| Used for personal development | Used for collaboration and backup |

#### How they are related

Local and remote repositories represent **two copies of the same project**.

* You work and commit changes locally.
* You synchronize those changes with the remote repository when needed.

{% hint style="warning" %}
Nothing is shared automatically.
{% endhint %}

### Push and Pull

| Push                  | Pull                       |
| --------------------- | -------------------------- |
| Local → Remote        | Remote → Local             |
| Shares your work      | Gets others’ work          |
| Requires commits      | Updates your local project |
| Used after committing | Used before starting work  |

{% hint style="info" %}
Commit locally, pull before work, push after work.
{% endhint %}

### Basic examples

```bash
# if it's a new project
git push origin main

# if it's an existing project
git pull
git push origin main
```

{% hint style="warning" %}
Only **committed changes** are pushed to the remote repository.

No commit = nothing to push.
{% endhint %}

<figure><picture><source srcset="/files/CfGs0FlyGtXV9qCTNcRp" media="(prefers-color-scheme: dark)"><img src="/files/Y3Is2LzW1zsl1b3WhnsD" alt="Diagram explain the deference between remote and local in GitHub with push and pull command - ITC"></picture><figcaption></figcaption></figure>

#### For deeper details:

[Pushing changes →](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository)

[Pulling changes →](https://docs.github.com/en/get-started/using-git/getting-changes-from-a-remote-repository)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.elorabiabderraouf.dev/documentation/git-github/workflow/local-vs-remote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
