Skip to main content

Git push with +

TIL that + sets a force flag on a Git refspec. That means I can force push to a branch with any of the following commands:

sh
git push --force origin main
git push -f origin main
git push origin +main

https://stackoverflow.com/a/69745212