Search code examples
gitgit-tower

Bitbucket - Tower - Undo/Delete Previous Commits


I have been through quite a bit of posts, but I cannot get this to work. So... I am using Tower and accessing a remote branch called stag. I am trying to undo/delete commits that were done after a certain commit (let's say hash - 0008).

A couple of notes: there are others that use this branch (they pushed the wrong commits - so they know this is coming) and I don't care about losing history or anything after 0008.

I've tried a git reset --hard 0008, which works locally, but doesn't push to remote without a pull that undoes it. I can logon to bitbucket directly if need be.

I've tried a git revert back 60 commits, but got "Commit #3434353 is a merge but no -m option was given. fatal: revert failed.


Solution

  • Found it - noted below for others:

    git reset --hard 0008
    git push -u origin branchName --force
    

    If some has a better solution please share and I'll mark it.