Restore default branch from tag while preserving history

Fore self reference:

To restore default branch from a tag while preserving history, do:

$ git checkout tags/v1.2.3 -b v1.2.3
$ git diff main > /tmp/diff.patch
$ git checkout main
$ cat /tmp/diff.patch | git apply
$ git commit -am "Rolled back to v1.2.3"
$ git push origin main
---
If you have any questions or feedback, please reach out @flowerinthenyt.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.