GitHub

GitHub

how to Sync your fork to the original repository

I, myself found a difficulty to keep my fork Synchronized to the original repository, but with a little search, I found the easiest solution with these three git commands.

Solution

First, you need to go into your repository folder. 1.png the first command we'll go to run is:

git fetch upstream

it fetches changes from the original repository.

2.png the next thing we want to do is switch to the clones branch using the next command:

git checkout branch name

branch name for me it happens to be "main", but usually, it will be "master".

3.png after switching to the clone branch we will merge changes from the original repository to the local clone using the git command:

git merge upstream/branch name

4.png and finally, we will use the last command to push changes from clone to fork:

git push

6.png

How to find the branch name?

to check for the branch name all you need to do is to go into your repository folder and type the next command "git branch". 5.png