Wednesday, July 9, 2014

How To Recover Deleted Files From GitHub

Background

I mistakenly deleted a folder vendor under web project. Now I need to recover files back except socket

Procedures:

# List file deleted from gitHub. In this case, all my files are under vendor dir
git log --diff-filter=D --summary | grep delete   | egrep vendor > deletedFiles.txt

#prepare a script to check out the deleted files [which I am interested]
for file in $(cat deletedFiles.txt)\
do \
     echo git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"; done | egrep vendor > getBackFiles.sh \
done

# change file permission so that I can run
chmod 755 getBackFiles.sh

# run the script created
./getBackFiles.sh

No comments:

Post a Comment

Anypoint Studio Error: The project is missing Munit lIbrary to run tests

Anypoint Studio 7.9 has a bug. Even if we following the article: https://help.mulesoft.com/s/article/The-project-is-missing-MUnit-libraries-...