Repository navigation
Keep the fork synchronized with MONAN‐Model
It is very important to keep your fork synchronized with the MONAN-Model repository. Mainly before submitting a Pull Request. This avoids conflicts between repositories and keeps your repository updated with the latest fixes.
As the Pull Request must be made to the "develop" branch, this branch must always be updated between the fork and the "develop" branch of MONAN-Model.
Below are two methods to maintain this synchronization.
1.1. Go to your fork and click on "sync fork"

1.2. You will have two options: 'compare' or 'update branch'.

1.3. After update the "main" branch switch to the "develop" branch and update it too.

Note
If changes from the upstream repository generate conflicts, GitHub will prompt you to create a pull request to resolve the conflicts.
2.1. Adding MONAN-Model as upstream
In the terminal/folder of your fork.
$ git remote add upstream https://github.com/monanadmin/MONAN-Model.git
This command add an additional remote repository called 'upstream' to your Git project.
2.2. Bring branches from the upstream remote repository
$ git fetch upstream
This command downloads all updates from the upstream remote repository, without changing any files in your local project.
2.3. Merge from upstream
If you don't have the develop branch in your fork, run this command first: $ git checkout --track origin/develop
If you have it in your 'workdir', run: $ git checkout develop
$ git merge upstream/develop
Note
If the local branch has unique commits, conflicts may need to be resolved.
Fork sync only updates the local copy of the repository. To update the fork on GitHub, you need to push the changes, the command is: $ git push origin.
Others cases
2.4 To update another branch, simply repeat the procedure.
2.5 If you want to insert a branch that only exists in the "Upstream" (MONAN-Model) for your Fork (Origin), the example is:
$ git checkout release/1.2.0-rc
Branch 'release/1.2.0-rc' set up to track remote branch 'release/1.2.0-rc' from 'upstream'.
Switched to a new branch 'release/1.2.0-rc'$ git push origin release/1.2.0-rc
2.6 To update all tags
$ git fetch upstream --tags
$ git push origin --tags
2.7 To update all branches automatically
2.7.1. Create a shell script:
for branch in $(git branch -r | grep upstream/ | sed 's|upstream/||'); do
git checkout $branch
git merge upstream/$branch
done2.7.2. Run the push command
$ git push origin --all
Note: Pay attention to the automatic method in relation to possible merge conflicts.
[1] Sincronizar uma bifurcação - https://docs.github.com/pt/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork?platform=linux
[2] Hacks do Github - Mantendo repositório forkado sincronizado com o original - https://dev.to/jhonywalkeer/hacks-do-github-mantendo-repositorio-forkado-sincronizado-com-o-original-3p1p
[3] Keeping your fork in sync - https://github.com/MPAS-Dev/MPAS-Model/wiki/Keeping-your-fork-in-sync