Delete modified files with Git

Git is great but a lot of times I am hopping from laptop to desktop to work computer and a project I’ve been working on has modified files on a computer I haven’t used in a while. You should get in the habit of adding, committing to your local repository and then pushing to your github repository. Sometimes I forget to add, commit and or push and my files get out of wack. Today I hopped on my home computer and it’s been like 2 weeks since I used it and I had a bunch of modified files. I know these files are way old and I just want to delete them with Git and then just pull down my most recent stuff from github.

How do I do this?

Simple:

$ git reset --hard HEAD

Leave a Reply

Your email address will not be published. Required fields are marked *