The issue is that after your delete and push branch it isn't lost forever and it is still in repository. I've deleted branch with big amount of needless files, but as long it is still somewhere in git repository, git clone command duration is too big.
For now only way I see is to delete whole repository and recreate it but without needless branch.
Deleting a branch LOCALLY Delete a branch with git branch -d <branch> . The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.
To delete many branches based on a specified pattern do the following: Open the terminal, or equivalent. Type in git branch | grep "<pattern>" for a preview of the branches that will be deleted. Type in git branch | grep "<pattern>" | xargs git branch -D.
What Happens If I Delete a Git Branch? When you delete a branch in Git, you don't delete the commits themselves. That's right: The commits are still there, and you might be able to recover them.
I believe git gc --prune=now
will do what you want: clean up unnecessary files from your repository.
By default git gc
removes unreachable commits older than 2 weeks, so adding --prune=now
is what you need.
You need to remove files completely by using git filter-branch
http://git-scm.com/docs/git-filter-branch
You can do a lot of magic with this command, the following will remove filename from all commits:
git filter-branch --tree-filter 'rm -f filename' HEAD
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With