I committed and pushed changes to my package-lock.json file two commits ago.
How do I uncommit the changes to this specific file?
I've looked at commands like $ git reset HEAD~2
but can't figure out how to target the specific file only.
I committed and pushed changes to my package-lock.json file two commits ago.
How do I uncommit the changes to this specific file?
I've looked at commands like $ git reset HEAD~2
but can't figure out how to target the specific file only.
I am assuming you committed changes in a file, which should not have been commited, and now you want to rewrite history to undo this.
I would recommend using interactive rebase. Like this:
git rebase --interactive HEAD~3
Then it will give you a file to edit (like commit) where you can choose for each commit (the last three in this case) what to do. Then you chose amend
for the commit where you did the stuff you want to erase from history.
Then you undo the damage, and put git rebase --continue
.