Nir
Nir

Reputation: 2082

How to delete GIT branch completely?

My local GIT repository became very big and I'm trying to free some hard drive space. I deleted all my old branches and left only the last one. In order to delete branches from my repository, I used the command

git branch -d [my branch name]

The problem is that when I check the repository space usage, it still uses the same amount. Running the garbage collector

git gc

after branches deletion didn't help.

The biggest git repository file is a .pack file inside the .git/objects/pack folder, it takes about 750MB, while the latest branch takes 112MB.

EDIT: I also tried all the

git reflog expire --all --expire=now
git gc --prune=now --aggressive

Neither helped.

Upvotes: 0

Views: 2387

Answers (1)

user8128167
user8128167

Reputation: 7696

If you want to delete your remote branch as of v1.7.0, use this command:

git push origin --delete the_remote_branch

Source https://makandracards.com/makandra/621-git-delete-a-branch-local-or-remote

Upvotes: 1

Related Questions