Merge branch 'Gregf36665-main-patch-06896' into 'main'

Add undoing an accidental merge

See merge request 2009scape/contributor-wiki!1
This commit is contained in:
Ceikry 2024-03-07 17:02:14 +00:00
commit 59174abf53

View file

@ -92,4 +92,37 @@ $ git checkout cider
$ git rebase master
$ git push origin cider
```
And now your `cider` branch is updated onto the changes present in the updated master branch.
And now your `cider` branch is updated onto the changes present in the updated master branch.
## Best Practices: Undoing an accidental merge
At some point you probably will accidentally merge the main repo into your branch.
You will need to undo this; we cannot accept MRs that have a merge as a commit.
The sooner you fix it the better.
Let's say you have accidentally merged changes from the main repo into a branch caller `cider` on your fork.
Here's how you can undo it:
0) If you are worried you may lose some work copy the files somewhere else.
In theory you should not lose anything but if you do not feel confident with git copy your changes elsewhere.
1) Roll your branch back to before you merged (ideally just one commit back):
```
git reset --hard HEAD~1
```
or
```
git reset --hard {commit hash}
```
2) Force push this rollback to *your* repo/branch (`cider` in this example)
```
git push --force origin cider
```
3) Follow [Best Practices: Updating Your Fork](Git-Basics.md?ref_type=heads#best-practices-updating-your-fork).
4) If you've lost something you did not backup you can use ```git checkout {hash}``` to try and find the pieces.