Back files deleted in Git

4

Friends, good afternoon.

I removed some files inside the server, however I need them again, I have them in the git repository.

How do I redownload the repository files?

    
asked by anonymous 25.04.2016 / 20:43

3 answers

2

You just need to revert the commit you used to delete the files.

git revert <commit>

Where <commit> is the number of the commit you want to undo.

Git Revert documentation .

    
25.04.2016 / 20:46
2

I think I would use this command:

 git reset --hard HEAD
    
25.04.2016 / 20:52
2

Use $ git checkout chave where the keyword is the branch number in a phase where your files existed. Ex: $ git checkout bc39326028de55653c8245cb7077b44023239735 At this point you will see your files back. Copy these files out of your GIT-controlled folder and go back to your previous version. Use $ git checkout aChaveInicial again. Pass the files you copied out of the directory to the desired location. Make a $ git add . and then $ git commit -m "arquivos de volta" . Ready, your files are back and with the latest version of your project.

In order to better visualize dates and keys use $gitk

    
25.04.2016 / 20:54