2

I'm working with a repo that uses git. I ran make depend and it modified a bunch of recursive Makefiles. git diff shows an emdless list of changes, and I'd like to reset the repo.

Under SVN, I would simply delete the files (and directories) and svn update to re-check them out.

I tried to do the same according to Restore a deleted file in a Git repo. Unfortunately, nothing was checked back out:

$ git reset HEAD; git checkout --
Unstaged changes after reset:
D   ACKNOWLEDGMENTS
D   CHANGES
D   CHANGES.SSLeay
D   Configure
D   FAQ
D   GitConfigure
...
$ ls
$

How do I reset this repo? Or is it easier to delete it and them re-check it out as if its a fresh checkout?

Community
  • 1
  • 1
jww
  • 97,681
  • 90
  • 411
  • 885

1 Answers1

5
  1. Reset to HEAD:

    git reset --hard HEAD
    
  2. Clean out anything else left behind:

    git clean -fxd
    

Be warned that both of these commands can delete information and lose state. Make sure to make a backup if you might lose something.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
  • Perfect, thanks. I'm not allowed to mark your answer yet, but I will when allowed. – jww Oct 19 '13 at 04:47