Answers for "How do I reset the git master branch to the upstream branch in a forked repository?"

0

How do I reset the git master branch to the upstream branch in a forked repository?

You can reset your local master branch to the upstream version and push it to your origin repository.

Assuming that "upstream" is the original repository and "origin" is your fork:

# ensures current branch is master
git checkout master

# pulls all new commits made to upstream/master
git pull upstream master

# this will delete all your local changes to master
git reset --hard upstream/master

# take care, this will delete all your changes on your forked master
git push origin master --force
(You can define the original repo as "upstream" with git remote add upstream /url/to/original/repo.)
Posted by: Guest on March-15-2022

Code answers related to "How do I reset the git master branch to the upstream branch in a forked repository?"

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language