0

I am using VS 2017 with Github. All developers in our team sync their changes to dev remote branch. We also have staging branch. So whenever we need to deploy new code to UAT we merge dev branch to staging branch and deploy from staging branch.

Today, i accidentally merged dev to staging and then synced staging branch with github. So all changes ended up in remote staging branch in github.

enter image description here

The screen shot below shows history of staging branch. I need to reset all the changes after 6/11/2018 02f35fec ( the highlighted in above pic)

I tried reset option with hard delete. However that only resets local branch. When try to sync to github it pulls all changes back into local branch from remote branch. (VS does not show anything in outgoing changes).

There is also a revert option, but it does not allow bulk revert

Is there anyway to revert or reset all changes after certain point and push to remote branch?

LP13
  • 30,567
  • 53
  • 217
  • 400
  • Possible duplicate of [How can I remove a commit on GitHub?](https://stackoverflow.com/questions/448919/how-can-i-remove-a-commit-on-github) – phd Jul 10 '18 at 20:31
  • @phd it looks like the suggested solution is for single commit. When i merged `dev` branch to `staging` it pushed all the changes from 6/11/2018 to `staging`. i want to un-commit all the commits after `02f35fec` ( the highlighted in the above pic) – LP13 Jul 10 '18 at 21:30
  • The solution is the same: `git reset --hard HEAD~XXX` where `XXX` is the number of commits to remote; and then `git push --force origin staging`. – phd Jul 10 '18 at 21:32
  • https://stackoverflow.com/q/2389361/7976758 – phd Jul 10 '18 at 21:33

0 Answers0