PHA
PHA

Reputation: 1668

revert a commit after push, checkout a commit behind and modification of files

I'd like to revert a simple commit e.g. c2 which has been pushed to mater branch. As I introduces some bugs on c2 I checked out one commit behind c2 (e.g. c1) and modify files. Now my app works fine and I just want to commit and push current files. But I can't as I am not on any branch.

* (no branch)
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

I want to make sure what should I do.

Upvotes: 1

Views: 58

Answers (1)

Mykola Gurov
Mykola Gurov

Reputation: 8725

You probably don't want to rewrite the history of your pushed branches. Then the simplest way for you would be to do explicit revert:

 git checkout master
 git revert c2 #will create a new commit which would effectively negate your c2
 git push origin mater

Upvotes: 1

Related Questions