# How to Do a “Git Export” (Like “Svn Export”)?

In Git, there isn't a direct equivalent of `svn export`, which creates a clean copy of a repository without any version control metadata. However, you can achieve a similar result by using `git archive` combined with a pipe to extract the archive to a directory.

Here's how you can do it:

1. Navigate to the root directory of your Git repository in your terminal.
2. Use the `git archive` command to create an archive of the repository. You can specify the branch or commit you want to export:
    
    ```bash
    git archive --format=zip --output=<output-file>.zip <branch-or-commit>
    ```
    
    Replace `<output-file>` with the desired name of the zip file to be created, and `<branch-or-commit>` with the branch name or commit hash you want to export.
    
    For example, to export the `master` branch to a file named `repo-export.zip`, you would run:
    
    ```bash
    git archive --format=zip --output=repo-export.zip master
    ```
    
3. Extract the zip file to a directory using a tool like `unzip`:
    
    ```bash
    unzip repo-export.zip -d <output-directory>
    ```
    
    Replace `<output-directory>` with the directory where you want to extract the contents of the zip file.
    
    For example, to extract the contents of `repo-export.zip` to a directory named `exported-repo`, you would run:
    
    ```bash
    unzip repo-export.zip -d exported-repo
    ```
    

This process creates a zip archive of the specified branch or commit without any version control metadata, similar to `svn export`. Then, it extracts the contents of the archive to a directory, providing a clean copy of the repository.

### Note:

- The `git archive` command can produce archives in various formats (`tar`, `zip`, etc.). Adjust the `-format` option accordingly based on your preference.
- You can also use other tools like `tar` instead of `zip` for creating the archive, depending on your requirements.
- This approach does not include any untracked files in the export. If you want to include untracked files, you need to add them to the index (`git add`) before creating the archive.