The main purpose of forking a repository is to propose changes and in other words, work together. Below are the steps to do that
1. Setup the Git
2. Clone the repository to the local repository
To clone, we can get the clone url and enter the following in the terminal
git clone
after cloning, we can see the details of the remote repository like this
git remote -v
git remote -v
origin https://github.com/mrrathish/TestGitProj.git (fetch)
origin https://github.com/mrrathish/TestGitProj.git (push)
in the above, essentially, it like the format below
origin https:github.com//
Now we need to add upstream repositories so that we can sync up.
git remote add upstream https://github.com/mrrathish/TestGitProj.git
After adding the upstream info, the remote -v command will give the details like below
git remote -v
origin https://github.com/mrrathish/TestGitProj.git (fetch)
origin https://github.com/mrrathish/TestGitProj.git (push)
upstream https://github.com/mrrathish/TestGitProj.git (fetch)
upstream https://github.com/mrrathish/TestGitProj.git (push)
In the above, the original format of upstream is,
upstream https://github.com//
Now everything is setup for Synching. Below gives info on how to sync the fork
to sync the online repository with the local one, below are the steps
1. git fetch upstream (this fetches the commits from master into the local branch upstream/master)
2. git checkout master (checkout fork’s local branch)
3. git merge upstream/master (merges the changes from upstream/master into the local master. This brings fork’s master in sync with the upstream master)
Note that Synching the fork only updates the local copy of the repository. To update the fork on github, one must Push the changes
References:
No comments:
Post a Comment