# Git Basics

## git push — remote vs branch syntax

**Problem:** `git push -u main` throws:
fatal: 'main' does not appear to be a git repository
fatal: Could not read from remote repository.

**Diagnosis:** Git expected a remote name but got a branch name.

**Fix:**
git push -u origin main

**Key insight:** The syntax is always remote first, branch second.
`origin` = where to push (the remote repository)
`main` = which branch to push
`-u` = sets origin/main as the default tracking branch,
so future pushes only need `git push`

## Git Basics — Vault Sync Workflow

### What we set up
- Vault folder (`05_vault`) initialised as a Git repo on the desktop
- Remote added: `git@git.bujour.de:patsy/Vault.git` (Forgejo, port 2222)
- Pushed from desktop → Forgejo → pulled onto laptop
- Desktop clone deleted and re-cloned fresh from Forgejo (clean slate)

### Day-to-day rhythm
- **Before starting:** `git pull origin main` — get what's on the remote
- **After changes:** `git add .` → `git commit -m "message"` → `git push origin main`

### Key distinction
| Command | What it does |
|---|---|
| `git fetch` | Downloads new commits from remote — does NOT touch your files |
| `git pull` | fetch + applies changes to your working files |

### Mental model
The remote (Forgejo) is the ocean. You push water out, you pull water back in.
One branch, working alone → pull before you start, push when you're done.

### Index line
`git_basics.md` — day-to-day sync rhythm, fetch vs pull distinction