Add guide for fixing broken master/main

This commit is contained in:
GregF 2024-03-25 17:35:02 +00:00
parent 59174abf53
commit b1ea4b9861

View file

@ -126,3 +126,18 @@ git push --force origin cider
4) If you've lost something you did not backup you can use ```git checkout {hash}``` to try and find the pieces.
## Undoing updating a local master
It's possible at some point you accidently update your master branch. This will cause you problems. Before you do this you will need to temporarly allow [force pushing](https://docs.gitlab.com/ee/user/project/protected_branches.html#allow-force-push-on-a-protected-branch) to your master branch. Make sure to turn it off afterwards.
1) Get the latest upstream files
```
git fetch -ap upstream
```
2) Reset your master branch. **Warning you will lose any locally changed files that are only on master!**
```
git reset --hard upstream/master
```
3) Push to your master branch
```
git push origin master --force
```