Dims
Dims

Reputation: 50989

How to revert commits to a branch, keeping them in their own branch?

One programmer has erroneously pushed his commits to devel branch instead of his own branch. Then he made his own branch and continued to work in it correctly. But develop branch appeared to be "contaminated" with wrong unapproved commits.

How to rollback this?

Upvotes: 1

Views: 31

Answers (1)

Emadpres
Emadpres

Reputation: 3737

First fix the local side as:

git checkout dev
git reset --hard HEAD^

Then push this update to the remote with --force as:

git push --force

Upvotes: 1

Related Questions