zeid10
zeid10

Reputation: 541

Removing a bad commit pushed using git

I am working on a project using BitBucket. I have been able to commit/push all my code until one day my vendor was not ignored, not sure why.

In order to fix I had to un-track the vendor folder. Doing that caused my files in the repository being removed because it was not being tracked anymore.

Now every time I need to push something and do a git pull it deletes my entire vendor folder.

How can I remove this commit and go back to a good commit?

Below is my git log showing the merges, etc. I would like to go back to this hash commit(e5835fa) which is my good commit before the "untrack vendor directory".

* 66ef40d (HEAD, origin/master, origin/HEAD, master) finalized importing players from excel.
* cfa37b3 pushing import players code
* 3a8f272 implemented importing players from excel.
* 9cf59ad implemented importing players
* 188db12 implemented imprting for players oly from excel file
* 72c086a untrack vendor directory
* e5835fa refactoring chart  display
* a5ffd72 fixed offset on duplicate players started import tool for players and  teams.
* 349dfc0 divided the result by 2
* 27e2845 updqted the sql duplicate teams.
* 80b3741 format change.

Upvotes: 0

Views: 57

Answers (1)

tehp
tehp

Reputation: 6394

Rollback to the specified commit:

git reset --hard e5835fa

Move head:

git reset --soft HEAD@{1}

Commit this state:

git commit -m "Rollback to e5835fa"

Push the changes (if desired):

git push

Upvotes: 1

Related Questions