How do I remove a commit from the history?

Asked

Viewed 62 times

1

In the first commits I versioned my e-mail password, now I uploaded a file. dist without this password, but wanted to remove from the commit history the file that had my password.

That’s possible?

If I browse github in my commit histories, I can view the old version with the password.

1 answer

0

I figured out which commit I wanted to go back to:

git log

I went back to an earlier one than I had versioned:

git reset (hash do commit)

If you also want to undo the changes in the file:

git reset (hash commit) --hard

Since I didn’t want to lose the content I didn’t use --hard

Removing the Github commit

git push --force

Browser other questions tagged

You are not signed in. Login or sign up in order to post.