DEV Community

Discussion on: What is your greatest issue with git/GitHub?

Collapse
 
gkucmierz profile image
Grzegorz Kućmierz

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.

Collapse
 
manumagalhaes profile image
Manu Magalhães • Edited

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