/workbook/htmls/20-Repo_Maintenance.html

http://github.com/matthewmccullough/git-workshop · HTML · 44 lines · 26 code · 18 blank · 0 comment · 0 complexity · ae193c9973a93cea4ad9d7f71731852e MD5 · raw file

  1. <link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
  2. <h1>Maintenance</h1>
  3. <h2>File System Check</h2>
  4. <p>File system check verifies integrity. Finds corrupt objects.</p>
  5. <pre><code>git fsck
  6. </code></pre>
  7. <p>Find orphaned objects that would be cleaned by prune</p>
  8. <pre><code>git fsck --orphaned
  9. </code></pre>
  10. <h2>Prune</h2>
  11. <p>Prune is a command that optimizes your repository by removing commits that are not orphaned.</p>
  12. <pre><code>git prune
  13. </code></pre>
  14. <p>or to see what is orphaned, but not actually touch them:</p>
  15. <pre><code>git prune --dry-run
  16. </code></pre>
  17. <p>or</p>
  18. <pre><code>git prune -n
  19. </code></pre>
  20. <h2>Garbage Collect</h2>
  21. <p>GC compacts old loose commits into pack files and <code>prune</code>s orphan commits. It is a superset of the <code>prune</code> command and is more commonly run than <code>prune</code>.</p>
  22. <pre><code>git gc
  23. </code></pre>
  24. <p>or to compress and optimize for space and speed</p>
  25. <pre><code>git gc --aggressive
  26. </code></pre>