Git GC

1.0K    Asked by SiyaKohli in Devops , Asked on Nov 9, 2019
Answered by Siya Kohli

Git gc performs garbage collection on your repository. Suppose you create a branch, change a bunch of files, commit your changes, do that again, and then delete the branch without merging it. All of those changed files and commits are sitting around taking up space, but you’re probably never going to use them again.

git gc deletes objects that are no longer part of any branch. (There are subtleties involving the reflog, which keeps track of those objects just in case you need them, so you have to tell gc how old the garbage has to be before you collect it.)


Your Answer

Interviews

Parent Categories