DEV Community

Discussion on: Git hacks you should know about

Collapse
 
sivaraam profile image
Kaartic Sivaraam • Edited

An easier way to remove a file that has been added to the last commit by mistake:

git rm --cached <wrong_file>
git commit --amend

This doesn't delete the file, though. Dropping '--cached' would delete it.

Collapse
 
iankurbiswas profile image
Ankur Biswas

Great 👍🏻