# How to maintain a fork up to date ?
## Requirements
* Setup an upstream remote (product team repository)
* Never push on `develop` or `release/*` branches on fork
* Use a dedicated branch for project developments
## Context
We consider that you have cloned fork repository and your working directory is project folder
## Setup remotes
Check your current remotes with following command :
```shell=
git remote -v
```
it may output :
> origin git@gitlab.wynd.eu:wynd-projects/decathlon-spain/monorepo.git (fetch)
origin git@gitlab.wynd.eu:wynd-projects/decathlon-spain/monorepo.git (push)
upstream git@gitlab.wynd.eu:wynd-product/pos/monorepo (fetch)
upstream git@gitlab.wynd.eu:wynd-product/pos/monorepo (push)
If not add upstream with following command :
```shell=
git remote add upstream git@gitlab.wynd.eu:wynd-product/pos/monorepo
```
## Maintain product branches up to date
*Products branches* : `develop` or `release/*`
Before start make sure your local repository is up to date with following command :
```shell=
git fetch -all
```
Then you can upgrade your local branch (`develop` or `release/*` depends of needs) with latest version from upstream (product repository)
```shell=
git pull -ff upstream develop
# or for example
git pull -ff upstream release/v7.0.0
```
Once local branches are up to date you can push updates to project repository :
```shell=
git push origin develop
# or for example
git push origin release/v7.0.0
```
## Update your dedicated branch
Once the product branches are up to date on local and project repositories you can rebase your dedicated branch :
```shell=
git rebase develop my-dedicated-branch
# or if you need to sync with a release branch
git rebase release/v7.0.0 my-dedicated-branch
```
Then push to project repository
```shell=
git push origin my-dedicated-branch
```