# push, pull, fetch & Tracking — Git

Source: https://www.geekswithgeeks.com/en/git/git-push-pull-fetch

> Sync commits with a remote, and set up upstream tracking branches.

## push and pull

`push` sends your commits up; `pull` fetches and merges the remote's commits into your current branch.

```bash
git push origin main
git pull origin main
```

## fetch vs pull

`git fetch` downloads new commits from the remote **without** merging them — safe to run anytime to just look. `git pull` is really `fetch` + `merge` in one step.

## Tracking branches

`-u` links your local branch to a remote one, so future plain `git push` / `git pull` know where to go.

```bash
git push -u origin feature/login
# now just:
git push
git pull
```
