-1
Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    deleted:    public/index.html
    deleted:    public/CSS/1.css
    deleted:    public/CSS/2.css
    deleted:    public/CSS/3.css
    deleted:    public/CSS/4.css

I accidentally removed files. How can I restore back them?

Mike
  • 11
  • 1
  • 1
    `git checkout public` is probably what you want. I'm sure this question is a dupe, but I'm too lazy to look for the original. – larsks Oct 27 '16 at 01:23
  • "(use "git checkout -- ..." to discard changes in working directory)" –  Oct 27 '16 at 01:25
  • 3
    Possible duplicate of [Restore a deleted folder in a Git repo](http://stackoverflow.com/questions/30875205/restore-a-deleted-folder-in-a-git-repo) – das_j Oct 27 '16 at 06:44

3 Answers3

1

Just reset the working directory

git reset --hard

Or if there were other changes you could just checkout that directory

git checkout -- public/

Or if there were individual files you wanted to get back

git checkout -- public/<file>
Jeff Puckett
  • 37,464
  • 17
  • 118
  • 167
0

git stash or git stash --all might do as well

Pragun
  • 1,123
  • 8
  • 20
0

To return public/index.html do

git ckeckout master public/index.html
Mikl
  • 109
  • 3