Synchronize with a forked Git Repository

Enable Javascript to display Table of Contents.

Add Upstream

In a first step we must add the forked repository as upstream:
$ git remote -v
origin	git@test.net:krach/some-repository.git (fetch)
origin	git@test.net:krach/some-repository.git (push)
$ git remote add upstream git@test.net:MZAAF/some-repository.git
$ git remote -v
origin	git@test.net:krach/some-repository.git (fetch)
origin	git@test.net:krach/some-repository.git (push)
upstream	git@test.net:MZAAF/some-repository.git (fetch)
upstream	git@test.net:MZAAF/some-repository.git (push)

Fetch and Rebase

First we have to fetch the upstream repository:
$ git fetch upstream
remote: Enumerating objects: 130, done.
remote: Counting objects: 100% (130/130), done.
remote: Compressing objects: 100% (80/80), done.
remote: Total 195 (delta 58), reused 101 (delta 41), pack-reused 65
Receiving objects: 100% (195/195), 89.83 KiB | 44.91 MiB/s, done.
Resolving deltas: 100% (83/83), completed with 2 local objects.
From test.net:MZAAF/some-repository
 * [new branch]      fix_installer/2.280                           -> upstream/fix_installer/2.280
 * [new branch]      mm/1.208                                      -> upstream/mm/1.208
 * [new branch]      mm/1.253                                      -> upstream/mm/1.253
 * [new branch]      zeus                                          -> upstream/zeus
 * [new tag]         v3.500.529                                    -> v3.500.529
 * [new tag]         v3.500.510                                    -> v3.500.510
 * [new tag]         v3.500.516                                    -> v3.500.516
 * [new tag]         v3.500.519                                    -> v3.500.519
 * [new tag]         v3.500.520                                    -> v3.500.520
 * [new tag]         v3.500.521                                    -> v3.500.521
 * [new tag]         v3.500.522                                    -> v3.500.522
$ 
Now we can switch to the branch we want to synchronize and perform the rebase:
$ git checkout zeus
Switched to branch 'zeus'
Your branch is up to date with 'origin/zeus'.
$ git rebase upstream/zeus
First, rewinding head to replay your work on top of it...
Fast-forwarded zeus to upstream/zeus.
$ git status
Switched to branch 'zeus'
Your branch is ahead of 'origin/zeus' by 17 commits.
  (use "git push" to publish your local commits)
$ git push
Counting objects: 138, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (91/91), done.
Writing objects: 100% (138/138), 49.50 KiB | 49.50 MiB/s, done.
Total 138 (delta 76), reused 100 (delta 41)
remote: Resolving deltas: 100% (76/76), completed with 23 local objects.
remote: 
remote: To create a merge request for zeus, visit:
remote:   https://test.net/krach/some-repository/-/merge_requests/new?merge_request%5Bsource_branch%5D=zeus
remote: 
To test.net:krach/some-repository.git
   a70b870..1455cd7  zeus -> zeus
$
Source: medium.com