Recover deleted files with git

1

I created a repository in github, gave the git init of my folder and after that I did the foolishness to give these two commands below, after that my files that were in my folder are gone ... how to get back the files? I had not yet committed any.

git add -A

git reset --hard


deivison@Desso MINGW64 /c/xampp/htdocs/adega (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   .editorconfig
        new file:   .gitignore
        new file:   .htaccess
        new file:   application/.htaccess
        new file:   application/cache/index.html
        new file:   application/config/autoload.php
        new file:   application/config/config.php
        new file:   application/config/constants.php
        new file:   application/config/database.php
        new file:   application/config/doctypes.php
        new file:   application/config/foreign_chars.php
        new file:   application/config/hooks.php
        new file:   application/config/index.html
        new file:   application/config/memcached.php
        new file:   application/config/migration.php
        new file:   application/config/mimes.php
        new file:   application/config/profiler.php
        new file:   application/config/routes.php
        new file:   application/config/smileys.php
        new file:   application/config/user_agents.php
        new file:   application/controllers/Cliente.php
        new file:   application/controllers/Entrada.php
        new file:   application/controllers/Movimentacao.php
        new file:   application/controllers/Produto.php
        new file:   application/controllers/Saida.php
        new file:   application/controllers/Template.php
        new file:   application/controllers/Venda.php
        new file:   application/controllers/index.html
        new file:   application/core/index.html
        new file:   application/helpers/index.html
        new file:   application/hooks/index.html
        new file:   application/index.html
        new file:   application/language/english/index.html
        new file:   application/language/index.html
        new file:   application/libraries/index.html
        new file:   application/logs/index.html
        new file:   application/models/M_Cliente.php
        new file:   application/models/M_Produto.php
        new file:   application/models/index.html
        new file:   application/third_party/index.html
        new file:   application/views/entrada.php




deivison@Desso MINGW64 /c/xampp/htdocs/adega (master)
$ git push -u origin master
error: src refspec master does not match any.
error: failed to push some refs to 'origin'

deivison@Desso MINGW64 /c/xampp/htdocs/adega (master)
$ git reset --hard
    
asked by anonymous 21.07.2018 / 19:24

2 answers

1

Try to review in the log what happened to the git log command or if you prefer, use the git log -p -2 command. This will display the diff history of the last two changes or if you prefer to use this command to give a summary of the log:

git log --pretty=oneline

(remembering that this command will display summary information in a complete hash line and comment);

After doing this and checked try to recover with the commands: git checkout - filename or if you do not try git reset HEAD filename.

    
21.07.2018 / 20:33
-1

Try this git checkout master command if this does not resolve, I do not know any other way to recover your files.

    
21.07.2018 / 20:47