0

Because my git branch will use a lot of Space, so I have deleted many local branches in my local git directory by issues

git branch -D xxxx

However, no space is free up in my hardisk. I run git gc after delete branch.

git gc

However, more harddisk space is used after I run 'git gc'.

Any way that I can free harddisk space after delete the git branch in my harddisk? As I know, I can event recreate the delete branch if I can remember the commit hash. seems the branch content is still keep in git. And is that makes the space is not freed up.

want_to_be_calm
  • 1,477
  • 3
  • 23
  • 41
  • 1
    If your question is about reducing the size *of the central repo* (e.g: the one hosted on `github` or `gitlab` or ...), please note this is a completely different question. If it is the case, edit your question to ask that question instead. – LeGEC Feb 08 '23 at 06:18
  • 2
    also note that one side effect of the linked answer is that you delete your local reflog, and the safety net that comes with it (the "big undo stack" part). If you can live with the extra taken space, I would advise, in a general way, to live with the fact that your `.git/` directory may be a bit bloated for a few weeks. – LeGEC Feb 08 '23 at 06:21
  • Branches are pointers to commits. Branches do not use (much) memory. The commits may use a lot of memory or the binary files (that are usually in .gitignore). So deleting branches usually does not give any space on hard disk. – tomwaitforitmy Feb 08 '23 at 09:25

0 Answers0