-
Notifications
You must be signed in to change notification settings - Fork 23
Git Extreme Actions
Kjell Wooding edited this page Nov 9, 2020
·
3 revisions
I get asked a lot of git questions. Here's where I keep the more extreme answers
(Note: We use main in place of master, as this is the github default as of October 1, 2020.)
Okay, I now know my main branch was supposed to be used only to track the upstream project. How do I reset it to be in sync with upstream?
Here we assume you already have configured your upstream remote correctly.
git remote update
# the double hyphen ensures that upstream/main is
# considered as a revision and not confused as a path
git reset --hard upstream/main --
Then push this new branch-head to your origin repository, ignoring the fact that it won't be a fast-forward:
git push origin +main
ref: https://stackoverflow.com/questions/8134960/how-to-revert-master-branch-to-upstream