There are two repositories:
- bare repository, everyone takes a copy from it, it has a master branch, which always corresponds to the production state
- there is a local repository
The developer rolls back to the previous commit in the local git reset --soft
, then makes a commit, then push.
The push is rejected, the developer makes a pool and merges the local master with a remote one, after which the canceled lines of code again fall into place and the meaning of the idea is lost!
Tell me, please, how to roll back to the commit correctly and upload it to the remote repository?
git revert
and roll back any extra commits. - Costantino Rupertgit push --force
. Just do not abuse. - a_guragit reset --hard HEAD~1
. I recommend immediately understanding how the rest options of thereset
command work (that is,--soft
and the default option--mixed
). - Costantino Rupert