Git - How to revert, cancel last changes on remote server
Sometimes you do something wrong. For example, push to master branch dev commits or something else, what does not have to find itself here. There are present a lot of official recommends how to push revert commits... but honestly, in my case, it does not work in proper way, as you want. So, I found ferroconcrete method how to solve this issue. But it seems to somebody not gracefully, but it works at least. First step: Revert to required commit. git reset --hard <commit-hash> (This command will reset the branch to the specified commit. Be cautious when using --hard as it will discard changes in your working directory and staging area.) Second step: Create new branch from this point. git checkout -b <new-branch-name> (This command creates a new branch and switches to it. Replace <new-branch-name> with the desired name for your new branch.) Third step: Remove your damaged branch on server. git push origin --delete <branch-name> (Replace <br...