Can a user's push be reversed in git?

1

The topic is the following, I want to revert the Push of other users whenever I want, example:

  • UsrA and UsrB work in a repository
  • UsrB does a Push
  • UsrA wants to revert it completely so that it is as if UsrB never made that Push.

How could this be done?

    
asked by Andres Martinez 29.06.2017 в 23:51
source

1 answer

1

This happened to me recently.

One way to achieve this is:

  • User A downloads the changes from B
  • User A learns of the misfortune and decides to execute git reset until the last stable commit
  • User A uploads the changes to the remote repository using git push origin master --force

This last command considers origin as alias of the remote repository, and master as the name of the branch you are working on. It can change according to the configuration of your project.

    
answered by 29.06.2017 в 23:59