# How to remove local branches that aren't on remote?

This is the perfect method when you want to synchronize your local repository branches with your remote branches.

# Sync your branches

You just need to use the option `-p` or `--prune` during the **fetch** command.

```bash
git fetch --prune
```

> -p, --prune
> After fetching, remove any remote-tracking branches which no longer exist on the remote. You can check the [prune options](https://git-scm.com/docs/git-fetch#git-fetch---prune) too.

# Clean your local

If you want synchronize not just the branches, you can synchronize the current branch too, just using this commands below.

```bash
git pull --all
git reset --hard
git clean -df
```

# Thank you
Thank you for reading this article, I hope that it was useful for you.
If you use a different strategy let me know below! 

