Skip to content
Posted on:March 8, 2017 at 10:53 AM

Cleaning the Git repository

Cleaning the Git repository

How to clean the git

  • to see what’s dangling
git fsck
git reflog
  • to clean
git reflog expire --expire=now --all
git gc --prune=now
  • examples
git reflog expire --expire=now --all
git reflog
# reflog should be cleaned
michael@rei:~/stl/_devops/chef-sl_policy_import(master)$ git gc --prune=now
Counting objects: 409, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (304/304), done.
Writing objects: 100% (409/409), done.
Total 409 (delta 215), reused 126 (delta 56)
michael@rei:~/stl/_devops/chef-sl_policy_import(master)$ git fsck
Checking object directories: 100% (256/256), done.
Checking objects: 100% (409/409), done.