Git Tip #3 - Clear out dangling commits and unreferenced objects

Say you want to do some housekeeping on your repository because you did some cleanup but you do not see the size of your Git repository go down. Well you could be a victim of commits that are not reachable on any branch. As a consequence a regular GC does not do anything with it. The 1st command line below expires all unreachable commits. And the 2nd command line can then GC them.


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

Posted September 7, 2016

Up