If I committed something that I shouldn't commit. How to reverse it.
For example I accidentally committed .env file 5 commits ago, and I forgot to add it to .gitignore.
.env
.gitignore
I need clear Instruction, how to remove it from last 5-th commit without changing other commits.
Hi Grzegorz,
Have you found a solution yet? Give a go at this one (see the explanation for git reset HEAD~3): stackoverflow.com/a/46350644
git reset HEAD~3
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
If I committed something that I shouldn't commit.
How to reverse it.
For example I accidentally committed
.env
file 5 commits ago, and I forgot to add it to.gitignore
.I need clear Instruction, how to remove it from last 5-th commit without changing other commits.
Hi Grzegorz,
Have you found a solution yet? Give a go at this one (see the explanation for
git reset HEAD~3
): stackoverflow.com/a/46350644