@@ -461,7 +461,8 @@ <h2 id="_synopsis">SYNOPSIS</h2>
461461 [< code > --contains</ code > [< code > =</ code > < em > <object></ em > ]] [< code > --no-contains</ code > [< code > =</ code > < em > <object></ em > ]]
462462 [(< code > --exclude=</ code > < em > <pattern></ em > )…​] [< code > --start-after=</ code > < em > <marker></ em > ]
463463 [ < code > --stdin</ code > | (< em > <pattern></ em > < code > ...</ code > )]
464- < code > git</ code > < code > refs</ code > < code > exists</ code > < em > <ref></ em > </ pre >
464+ < code > git</ code > < code > refs</ code > < code > exists</ code > < em > <ref></ em >
465+ < code > git</ code > < code > refs</ code > < code > optimize</ code > [< code > --all</ code > ] [< code > --no-prune</ code > ] [< code > --auto</ code > ] [< code > --include</ code > < em > <pattern></ em > ] [< code > --exclude</ code > < em > <pattern></ em > ]</ pre >
465466</ div >
466467</ div >
467468</ div >
@@ -499,6 +500,12 @@ <h2 id="_commands">COMMANDS</h2>
499500failed with an error other than the reference being missing. This does
500501not verify whether the reference resolves to an actual object.</ p >
501502</ dd >
503+ < dt class ="hdlist1 "> optimize</ dt >
504+ < dd >
505+ < p > Optimizes references to improve repository performance and reduce disk
506+ usage. This subcommand is an alias for < a href ="git-pack-refs.html "> git-pack-refs(1)</ a > and
507+ offers identical functionality.</ p >
508+ </ dd >
502509</ dl >
503510</ div >
504511</ div >
@@ -673,6 +680,74 @@ <h2 id="_options">OPTIONS</h2>
673680</ dd >
674681</ dl >
675682</ div >
683+ < div class ="paragraph ">
684+ < p > The following options are specific to < em > git refs optimize</ em > :</ p >
685+ </ div >
686+ < div class ="dlist ">
687+ < dl >
688+ < dt class ="hdlist1 "> --all</ dt >
689+ < dd >
690+ < p > The command by default packs all tags and refs that are already
691+ packed, and leaves other refs
692+ alone. This is because branches are expected to be actively
693+ developed and packing their tips does not help performance.
694+ This option causes all refs to be packed as well, with the exception
695+ of hidden refs, broken refs, and symbolic refs. Useful for a repository
696+ with many branches of historical interests.</ p >
697+ </ dd >
698+ < dt class ="hdlist1 "> --no-prune</ dt >
699+ < dd >
700+ < p > The command usually removes loose refs under < code > $GIT_DIR/refs</ code >
701+ hierarchy after packing them. This option tells it not to.</ p >
702+ </ dd >
703+ < dt class ="hdlist1 "> --auto</ dt >
704+ < dd >
705+ < p > Pack refs as needed depending on the current state of the ref database. The
706+ behavior depends on the ref format used by the repository and may change in the
707+ future.</ p >
708+ < div class ="ulist ">
709+ < ul >
710+ < li >
711+ < p > "files": Loose references are packed into the < code > packed-refs</ code > file
712+ based on the ratio of loose references to the size of the
713+ < code > packed-refs</ code > file. The bigger the < code > packed-refs</ code > file, the more loose
714+ references need to exist before we repack.</ p >
715+ </ li >
716+ < li >
717+ < p > "reftable": Tables are compacted such that they form a geometric
718+ sequence. For two tables N and N+1, where N+1 is newer, this
719+ maintains the property that N is at least twice as big as N+1. Only
720+ tables that violate this property are compacted.</ p >
721+ </ li >
722+ </ ul >
723+ </ div >
724+ </ dd >
725+ < dt class ="hdlist1 "> --include <pattern></ dt >
726+ < dd >
727+ < p > Pack refs based on a < code > glob</ code > (< code > 7</ code > ) pattern. Repetitions of this option
728+ accumulate inclusion patterns. If a ref is both included in < code > --include</ code > and
729+ < code > --exclude</ code > , < code > --exclude</ code > takes precedence. Using < code > --include</ code > will preclude all
730+ tags from being included by default. Symbolic refs and broken refs will never
731+ be packed. When used with < code > --all</ code > , it will be a noop. Use < code > --no-include</ code > to clear
732+ and reset the list of patterns.</ p >
733+ </ dd >
734+ < dt class ="hdlist1 "> --exclude <pattern></ dt >
735+ < dd >
736+ < p > Do not pack refs matching the given < code > glob</ code > (< code > 7</ code > ) pattern. Repetitions of this option
737+ accumulate exclusion patterns. Use < code > --no-exclude</ code > to clear and reset the list of
738+ patterns. If a ref is already packed, including it with < code > --exclude</ code > will not
739+ unpack it.</ p >
740+ < div class ="paragraph ">
741+ < p > When used with < code > --all</ code > , pack only loose refs which do not match any of
742+ the provided < code > --exclude</ code > patterns.</ p >
743+ </ div >
744+ < div class ="paragraph ">
745+ < p > When used with < code > --include</ code > , refs provided to < code > --include</ code > , minus refs that are
746+ provided to < code > --exclude</ code > will be packed.</ p >
747+ </ div >
748+ </ dd >
749+ </ dl >
750+ </ div >
676751</ div >
677752</ div >
678753< div class ="sect1 ">
@@ -711,7 +786,7 @@ <h2 id="_git">GIT</h2>
711786</ div >
712787< div id ="footer ">
713788< div id ="footer-text ">
714- Last updated 2025-09-12 12:13:52 -0700
789+ Last updated 2025-10-02 14:07:14 -0700
715790</ div >
716791</ div >
717792</ body >
0 commit comments