<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<article lang="en" id="git-pack-refs(1)">
<articleinfo>
    <title>git-pack-refs(1)</title>
        <indexterm>
                <primary>git-pack-refs(1)</primary>
        </indexterm>
</articleinfo>
<simplesect id="_name">
<title>NAME</title>
<simpara>git-pack-refs - Pack heads and tags for efficient repository access</simpara>
</simplesect>
<simplesect id="_synopsis">
<title>SYNOPSIS</title>
<simpara><emphasis>git pack-refs</emphasis> [--all] [--no-prune]</simpara>
</simplesect>
<simplesect id="_description">
<title>DESCRIPTION</title>
<simpara>Traditionally, tips of branches and tags (collectively known as
<emphasis>refs</emphasis>) were stored one file per ref under <literal>$GIT_DIR/refs</literal>
directory.  While many branch tips tend to be updated often,
most tags and some branch tips are never updated.  When a
repository has hundreds or thousands of tags, this
one-file-per-ref format both wastes storage and hurts
performance.</simpara>
<simpara>This command is used to solve the storage and performance
problem by stashing the refs in a single file,
<literal>$GIT_DIR/packed-refs</literal>.  When a ref is missing from the
traditional <literal>$GIT_DIR/refs</literal> hierarchy, it is looked up in this
file and used if found.</simpara>
<simpara>Subsequent updates to branches always creates new file under
<literal>$GIT_DIR/refs</literal> hierarchy.</simpara>
<simpara>A recommended practice to deal with a repository with too many
refs is to pack its refs with <literal>--all --prune</literal> once, and
occasionally run <literal>git pack-refs --prune</literal>.  Tags are by
definition stationary and are not expected to change.  Branch
heads will be packed with the initial <literal>pack-refs --all</literal>, but
only the currently active branch heads will become unpacked,
and next <literal>pack-refs</literal> (without <literal>--all</literal>) will leave them
unpacked.</simpara>
</simplesect>
<simplesect id="_options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
--all
</term>
<listitem>
<simpara>
The command by default packs all tags and refs that are already
packed, and leaves other refs
alone.  This is because branches are expected to be actively
developed and packing their tips does not help performance.
This option causes branch tips to be packed as well.  Useful for
a repository with many branches of historical interests.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
--no-prune
</term>
<listitem>
<simpara>
The command usually removes loose refs under <literal>$GIT_DIR/refs</literal>
hierarchy after packing them.  This option tells it not to.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="_author">
<title>Author</title>
<simpara>Written by Linus Torvalds &lt;<ulink url="mailto:torvalds@osdl.org">torvalds@osdl.org</ulink>&gt;</simpara>
</simplesect>
<simplesect id="_git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)"/> suite</simpara>
</simplesect>
</article>
