What is Upstream Repository in GIT?
Upstream repository is the Parent/Original repository from where you forked your repository.
What is Fork?
A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project.
We will be see how we can sync and merge the Upstream repository changes in our own forked repository?
When a repository is cloned, it has a default remote called Origin that points to your fork on GitHub, not the original repository it was forked from.To keep track of the original repository, you need to add another remote named
How to configure a Upstream repository?
git remote add upstream https://github.com/abhishekamralkar/emacs.d
You can verify it by below command
git remote -v
Below should be the output
origin [email protected]:abhishekamralkar/emacs.d.git (fetch)origin [email protected]:abhishekamralkar/emacs.d.git (push)upstream https://github.com/aa/emacs.d (fetch)upstream https://github.com/aa/emacs.d (push)
To sync the forked repository with the upstream repository follow below steps
git fetch upstream
2. Check out your fork’s local master branch.
git checkout master
3. Merge the changes from upstream/master into your local master branch.
git merge upstream/master