इस article के आधार पर, मैंने एक छोटी सी स्क्रिप्ट बनाई है जिसे पूरे गिट रेपो, सभी शाखाओं, टैग्स और कमेट्स में फ़ाइल की सभी घटनाओं को निकालना है। स्क्रिप्ट:सभी गिट इतिहास से फ़ाइल हटाएं
#!/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 cat -- --all');
child_process.execSync('echo "' + path + '" >> .gitignore', printLog);
child_process.execSync('git add .gitignore');
child_process.execSync('git commit -m "Add ' + path +' to .gitignore"',printLog)
child_process.execSync('git push origin --force --all',printLog);
child_process.execSync('git push origin --force --tags',printLog);
यह स्क्रिप्ट में कुछ रेपोस (जो निजी हैं) पर काम किया है और एक विशिष्ट एक पर यह प्रारंभिक फ़ाइल मैं दूर करने के लिए कोशिश कर रहा था के लिए प्रतिबद्ध रखा। स्क्रिप्ट चलाने के बाद मैंने यह git log --all -- .npmrc
किया और प्रारंभिक प्रतिबद्धता पाई। मैं क्या खो रहा हूँ?
sidenote: चेकआउट [बीएफजी, गिट-फ़िल्टर-शाखा के लिए एक सरल, तेज़ विकल्प] (http://rtyley.github.io/bfg-repo-cleaner) – laggingreflex
ने बीएफजी की कोशिश की, यह स्थानीय रूप से काम करता है लेकिन अद्यतन नहीं करता है रिमोट – qballer
@qballer, तो अपने परिवर्तन को दूरस्थ में धक्का दें? – Chris