how does git forking work?

A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.

No your fork won’t be updated automatically everytime and you can’t fork a repository more than once. If you want, you’ll have to delete the prev fork and refork the repo.

To keep your fork updated with original one you can follow below steps:

first add the original repo as a remote upstream in your local forked one:

git remote add upstream [upstream.git]

Now, you can easily syncronize your forked (origin) repository with the upstream one by doing

git checkout master # Make sure you always run the following commands from the master branch
git fetch --all
git pull --rebase upstream master
git push origin master

This will rebase the upstream changes on your local forked version so the master branch git history will look exactly the same at the end.

to pull from the original repo use:

git pull upstream master  # you will get the original repo's update

and to pull from the forked one:

git pull origin master

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top