Git Clear your History

Clear History have you ever checked in some binarys, confidential stuff or something else by mistake ? Git will keep all your history, that’s their design and purpose. how ever, if you need to cleanup once, here is a short tutorial. Kill Git Config cd myrepo cat .git/config -> note down the url rm -rf .git Create New Repo git init git add . git commit -m "Removed history, ..." Push Remote git remote add origin git@host/yourrepo <- URL you noted down above git push -u --force origin master All in One _url=$(git remote -v |awk '/fetch/ { print $2 }') rm -rf .


Some Git Commands Merge two Repos “merge unrelated histories” git pull origin master --allow-unrelated-histories git push git pull ###¬†Find deleted File git log --diff-filter=D --summary commit abcecadce91af3814662fa6a04d0f12e361f0574 Date: Sun May 31 23:19:59 2020 +0200 update delete mode 100644 master/sed.tcpdump commit 81ae58d70c27d02eb2f65beed4fe0b571073f087 Date: Fri May 29 16:06:14 2020 +0200 update Restore deleted File git checkout 81ae58d70c27d02eb2f65beed4fe0b571073f087 sed.tcpdump Remove Sensitive Data git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch .