Languages
[Edit]
EN

Git - compress .git directory

8 points
Created by:
daniell
490

In this short article, we want to show how to remove unnecessary files and compress required files in a better way in the .git directory.

Quick solution (run the following command in your project directory):

Example output:

Note: the above operation reduced .git directory size for the presented output from 2.61GB to 0.98GB.

 

From Git Documentation:

--prune=<date>

Prune loose objects older than date (default is 2 weeks ago, overridable by the config variable gc.pruneExpire). --prune=now prunes loose objects regardless of their age and increases the risk of corruption if another process is writing to the repository concurrently; see "NOTES" below. --prune is on by default.

 

References

Edit
  1. git-gc (--prune=<date>) - Git Documentation

Alternative titles

  1. Git - compress .git directory (in local Git repository)
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join