[Git] to delete all the history of a file, batch delete remote branch

Delete all the history of a file git

The purpose is to git version control, recording every version change. But sometimes we tend to want to completely delete a file from the repository, no longer appear in history. For example accidentally uploaded a bunch of wrong file, or accidentally uploaded the account number, password, how to do it this time? The following command can be the perfect solution to your problem


$ git filter-branch -f --tree-filter 'rm -rf common/service/SyncBlogServince.php' HEAD
$ git push origin --force


Batch delete git branch

git branch -r |grep 'origin/pmt_201608' | awk -F '/' '{print $2}' | xargs -I {} git push origin :{



Original Address: [git] to delete all the history of a file, batch delete remote branches
Tags: git    GitHub    batch    delete    branch   

Intelligent Recommendation

Reproduced in: https: //my.oschina.net/54php/blog/600311

Guess you like

Origin blog.csdn.net/weixin_33735077/article/details/91634924