OK. I was deleting precompiled assets in my public/assets folder. I accidentally deleted an entire folder I had in there as well. I checked out a repository and started webrick and the files seem to be loading, although when I look in the directory they aren't there? how do i restore/move those files back into the public/assets directory?
You can restore files or folder with git restore. Here, master~1 reverts your folder to "1" revision back from your master branch. You use HEAD too. for example: git restore --source=HEAD~2 "Path_To_Restore" .
You can restore a deleted file from a Git repository using the git checkout command. If you do not know when a file was last deleted, you can use git rev-list to find the checksum of the commit in which that file was deleted. Then, you can check out that commit.
Even better, in cases like committing a file deletion and then wanting to revert it, Tower's awesome undo feature lets you get the file back by simply pressing CMD-Z!
Git provides ways to recover a deleted file at any point in this life cycle of changes. If you have not staged the deletion yet, simply run `git restore <filename>` and the file will be restored from the index.
If you haven't commited the deletion. Check the changes that are pending with git status
and use git checkout
to restore a file to its last commited state ( HEAD ):
git checkout -- file_path
Git works on files not on directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With