FahamLah

Commands

git gc

git gc [--prune=<date>] [--aggressive]

Risk: Careful

What it does

Tidies the repo: packs objects and throws away ones nothing can reach.

When to use it

Rarely by hand. Git runs a light version by itself.

Example

$ git gc

Pack and tidy now. Objects in the reflog stay safe.

$ git gc --prune=now

Drop unreachable objects at once, with no grace time.