
Remote: Permission denied to force push branch master. Switch to master and reset it to remote, now master is reverted.In master branch, create the new branch, now it (new branch) has all the committed changes.If a mistake is made, instead of committing to a new branch, the changes were committed to local master: If committed to master instead of a new branch

They can follow these simple steps.Įlse, the bad commits which could have been pulled by other users could get re-committed. User who resets the master or staging or any branch which resides in remote need to inform other repository users so that they can reset their own local repository accordingly. Deploy to staging or production servers.

Now Git Push, option Force: unknown changes, the branch to BitBucket.Right click on the commit, select Reset "master" to this, option Hard.Select Show Log and look for the good commit. To rollback to a previous state (commit) you first need to identify the SHA for the commit you wish to go back to (as we did above) and then use the revert.Switch to the staging or master branch in local repo.After identifying the commit to revert to in the graph in BitBucket.Stash your changes if you have uncommitted changes.

The commit to revert to should be a closed dot, that is, not an open ended dot behind the bad commit. To identify the commit to revert to, read the commit graph carefully, pay close attention to the dots on the lines. If you want to just point to any previous commit use reset it points your local environment back to a previous commit.
When things go wrong, for example, caused by a bad commit, we need to revert back to an earlier known good commit. Or if the commit is a merge commit you can try this: 1.git revert -m 1