Antoine Maréchal
Antoine Maréchal

Reputation: 165

GIT / bitbucket - how to exclude 1 commit on bitbucket's master AFTER it was pushed

I've pushed 2 local commits onto bitbucket.org.

I would like to ignore, delete, forget the 1st one. So pretend it never existed.

But in my Pull request, both appear, I've got 2 bullet points.

Just talked to a colleague that stopped by: it appears the I need to initiate a Rollback. The Master repository Admin can only Merge or not, but not discard a commit I did?

Thank you

Upvotes: 0

Views: 1825

Answers (1)

ephemerr
ephemerr

Reputation: 1983

First and most safe way is to revert this commit:

git revert [your_bad_commit] 

It will add new commit which will undo changes of chosen one. Then push to master as usual.

Second way works only if you want undo last commit. Do

git reset [last_good_commit] --hard

By this you will discard all commits added after chosen one. Then push to master with --force flag:

git push -f

Warning: you lost all changes in master that not in you local master branch, so be careful with force push!

Upvotes: 1

Related Questions