= Merge upstream

Pre-requesite: link:track-upstream.adoc[Tracking upstream]

Make sure `main` is clean with no pending modification or unpushed commit.

```bash
# Create an upstream branch to merge upstream:
git checkout main
git pull
git checkout -b merge-upstream
git pull upstream main

# Compare branch with `main`
git checkout main
git diff --no-ext-diff main merge-upstream

# Rebase upstream branch to `main` branch if everything is ok then push:
git checkout main
git rebase merge-upstream
git push

# Remove no more used branch
git branch --delete merge-upstream
```

Using prezto aliases:

```bash
# Create an upstream branch to merge upstream:
gco main
gfm
gbc merge-upstream
gfm upstream main

# Compare branch with `main` branc
gco main
gwd main merge-upstream

# Rebase upstream branch to `main` branc if everything is ok then push:
gco main
gr merge-upstream
gp

# Remove no more used branch
gbx merge-upstream
```