Saturday, March 19, 2011

How to "svn export" like in Git

Let's clone a read-only git repository first using the ff example usage of the git clone command

git clone git://github.com/garrizaldy/squall.git

Now that we have a 'read-only' repository of the source code we want to execute a svn export like command.  We will be using git's checkout-index to perform something very similar to a svn export against a repository. You can use the ff guidelines below :

# checkout or export
# -a, --all checks out all files in the index. Cannot be used together with explicit filenames.
# -f forces overwrite of existing files
# --prefix When creating files, prepend (usually a directory including a trailing /)

git checkout-index -a -f --prefix=/path/to/directory/

No comments: