create new custom script file inside <your hexo project dir>/scripts/script-file-name.js.
<your hexo project dir>is your current site directory
'use strict';
/**
 * clean auto generated files inside .deploy_git
 */
// const path = require('path');
// const fs = require('fs-extra');
hexo.extend.filter.register('after_clean', function () {
  // your logic codes here
});