The --soft flag ensures changes from the deleted commit remain staged:
git reset --soft HEAD~1
git rebase main
git push --force-with-lease
In case there are conflict execute commands like git add ... and git rebase --continue
When relevant, priority can be given to feature branch changes with:
git rebase --main -Xtheirs
followed with:
git push --force
git pull --rebase
git log --oneline --decorate --all --graph
git rebase --interactive HEAD~3
git push --force origin feat/add-my-feature
Use git log and git reflog to identify the
commit to target and get its sha1, say COMMIT_HASH
Get back to that commit with:
git reset --hard COMMIT_HASH
Finally, push with:
git push origin feat/opensearch_operator --force-with-lease