How to delete a branch and all objects to which it referred

The problem is that after your delete and push branch it is not lost forever and is still in the repository. I deleted a branch with a lot of unnecessary files, but as long as it is still somewhere in the git repository, the clone git command takes too long.

So far, only I see that you need to delete the entire repository and recreate it, but without an extra branch.

+5
source share
2 answers

I believe git gc --prune=nowwill do what you want: clean up unnecessary files from your repository.

By default, it git gcremoves unreachable commits older than 2 weeks, so adding --prune=nowis what you need.

+4

, git filter-branch

http://git-scm.com/docs/git-filter-branch

, :

git filter-branch --tree-filter 'rm -f filename' HEAD
+3

All Articles