How to set GIT (master or branch) to a previous commit version

First you need to switch to the desired location master or branch
  • git checkout master or branch_name
Then
  • git push -f origin commit_id:master  (For master)
  • git push -f origin commit_id:branch_name ( For branch)
Then you also need to cancel your local commit
  • git reset --hard commit_id (from the desired location)

Comments

Popular posts from this blog

How to SSH to remote server without entering password each time.

How to implement Log File Rotation in Linux Servers