egg
egg

Reputation: 373

Rollback on SourceTree & Bitbucket

I've made a bunch of commits in the last day, installing a new extension to my Magento system.

I make these changes locally, then they are pushed to bitbucket, and then to my live/testing server.

My commits are rubbish - I need to go back to how the system was 2 days ago. How can I do that, taking into account the remote servers etc?

When I make a reset commit (hard) on sourcetree, it then wants to pull the remote server back in, as its ahead of us.

Upvotes: 1

Views: 2539

Answers (1)

VonC
VonC

Reputation: 1327224

If you are sure, you can, after your local reset, do a:

git push -f
# or
git push --force

That would force the upstream repo to mirror your local history (which you reset to 2 days ago)

That is only problematic if other people have already cloned your upstream repo and were working on it (probably not the case here)

Regarding the live server, it depends on how the commits are push to it:

  • if they are push from your local repo, that means git remote -v should list two remotes (one 'origin', and one with another name like 'live').
    In that case, a git push -f live would work.
  • if they are pulled by the live server from the BitBucket repo, the easiest way would be to access that server and do a git reset there.

Upvotes: 2

Related Questions