Home > Enterprise >  Delete all files from remote repository committed in past 5 days
Delete all files from remote repository committed in past 5 days

Time:11-22

I have a batch file with the following commands that will cause all files in my remote repository to be removed:

git rm -r  *
git commit -m "All Files Deleted"
git push

Instead of removing all files, is there any way to remove only files committed in the past 5 days?

CodePudding user response:

get a list of them and then remove them:

git diff --name-only $( git log --since=5.days.ago --pretty=%h --quiet | tail -n 1 ) | xargs git rm
  • Related