Re: how to export git repository?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Sat 2007-09-08 Tamas K Papp <tpapp AT Princeton.EDU>
* Message-Id: 20070908145555.GA24132 AT pu100877.student.princeton.edu
> Sorry, but I didn't find this in the documentation.  How can I export
> the contents of a repository (just the files, not the version control
> information)?
>
> I am looking for something similar to svn export.
>
> Thanks,
>
> Tamas

Here is my bash alias. The argument is the <branch name> to export.
An example:

    cd /path/to/foo/
    _gittar master

The output is (time in ISO 8601 / UTC):

    ../foot-YYYYMMDD.HHMM.tar.gz

Jari

function _gittar ()
{
    local name=$(pwd)
    name=${name##*/}

    if [ ! "$1" ]; then
        echo "[ERROR] what branch to export?"
        return 1
    fi

    local date=$(TZ=UTC date '+%Y%m%d.%H%M')
    local pkg="$name-$date"
    local dir=".."
    local tar="$dir/$pkg.tar.gz"

    git archive \
        --format=tar \
        --prefix="$pkg/" \
        "$@" |
    gzip --best > "$tar"

    echo $tar
}


-- 
Welcome to FOSS revolution: we fix and modify until it shines

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux