git remote -v
Result Befor set upstream:
origin https://github.com/[Your UserName]/[Your Fork].git (fetch)
origin https://github.com/[Your UserName]/[Your Fork].git (push)
git remote add upstream https://github.com/[Original Owner Username]/[Original Repository].git
Now try again
git remote -v
Result After set upstream:
origin https://github.com/[Your UserName]/[Your Fork].git (fetch)
origin https://github.com/[Your UserName]/[Your Fork].git (push)
upstream https://github.com/[Original Owner Username]/[Original Repository].git (fetch)
upstream https://github.com/[Original Owner Username]/[Original Repository].git (push)
git fetch upstream
Suppose we have a branch on our fork with name fork_branch and a branch on upstream with name upstream_branch. We want to sync fork_branch with upstream_branch
git checkout fork_branch
git reset --hard upstream/upstream_branch
git push origin fork_branch --force
We want our develop brach of our fork same as develop branch of upstream.
git checkout develop (this develop is for fork. local)
git reset --hard upstream/develop (this develop is for upstream. remote)
git push origin develop --force (this develop is for fork. remote)