Tag: git rewrite history

从所有的git历史中删除文件

基于这篇文章 ,我创build了一个小脚本,它应该删除整个git仓库中的所有文件,所有分支,标签和提交。 剧本: #!/usr/bin/env node var child_process = require('child_process'); if (process.argv.length < 3){ console.error('USAGE: git-forget path/to/file') process.exit(1); } var path = process.argv[2]; var phase = 0; function printLog(error, stdout, stderr) { if (error) { console.error('ERROR' + error); } console.log(++phase); console.log(stdout); } child_process.execSync('git filter-branch –force –index-filter \'git rm -f –cached –ignore-unmatch '+ path +'\' –prune-empty –tag-name-filter […]