Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 60819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:13:18+00:00 2026-05-10T18:13:18+00:00

I’ve been wondering whether there is a good "git export" solution that creates a

  • 0

I’ve been wondering whether there is a good "git export" solution that creates a copy of a tree without the .git repository directory. There are at least three methods I know of:

  1. git clone followed by removing the .git repository directory.
  2. git checkout-index alludes to this functionality but starts with "Just read the desired tree into the index…" which I’m not entirely sure how to do.
  3. git-export is a third-party script that essentially does a git clone into a temporary location followed by rsync --exclude='.git' into the final destination.

None of these solutions really strike me as being satisfactory. The closest one to svn export might be option 1, because both require the target directory to be empty first. But option 2 seems even better, assuming I can figure out what it means to read a tree into the index.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:13:18+00:00Added an answer on May 10, 2026 at 6:13 pm

    Probably the simplest way to achieve this is with git archive. If you really need just the expanded tree you can do something like this.

    git archive master | tar -x -C /somewhere/else 

    Most of the time that I need to ‘export’ something from git, I want a compressed archive in any case so I do something like this.

    git archive master | bzip2 >source-tree.tar.bz2 

    ZIP archive:

    git archive --format zip --output /full/path/to/zipfile.zip master  

    git help archive for more details, it’s quite flexible.


    Be aware that even though the archive will not contain the .git directory, it will, however, contain other hidden git-specific files like .gitignore, .gitattributes, etc. If you don’t want them in the archive, make sure you use the export-ignore attribute in a .gitattributes file and commit this before doing your archive. Read more…


    Note: If you are interested in exporting the index, the command is

    git checkout-index -a -f --prefix=/destination/path/ 

    (See Greg’s answer for more details)


    Here’s a real-world example using libchrony on Linux:

    mkdir $HOME/dev cd $HOME/dev pushd /tmp git clone https://gitlab.com/chrony/libchrony.git cd libchrony BRANCH=$(git rev-parse --abbrev-ref HEAD) git archive -o ../libchrony.zip --prefix="libchrony/" $BRANCH popd unzip /tmp/libchrony.zip 

    Those commands produce a zip file and extract it into $HOME/dev/libchrony. We can peek into the archive using:

    $ unzip -v /tmp/libchrony Archive:  /tmp/libchrony.zip e0a3807f770b56f6b0e9833254baa7c4fc13564b  Length   Method    Size  Cmpr    Date    Time   CRC-32   Name --------  ------  ------- ---- ---------- ----- --------  ----        0  Stored        0   0% 2023-07-20 09:37 00000000  libchrony/       49  Defl:N       47   4% 2023-07-20 09:37 37c3f2e2  libchrony/.gitignore    26530  Defl:N     9350  65% 2023-07-20 09:37 5622583e  libchrony/COPYING      961  Defl:N      467  51% 2023-07-20 09:37 da9221e3  libchrony/Makefile      475  Defl:N      304  36% 2023-07-20 09:37 cae27f70  libchrony/README.adoc     3313  Defl:N     1119  66% 2023-07-20 09:37 37eb110f  libchrony/chrony.h     7673  Defl:N     2261  71% 2023-07-20 09:37 5d455a52  libchrony/client.c     6190  Defl:N     2093  66% 2023-07-20 09:37 7ea9d81b  libchrony/example-reports.c    16348  Defl:N     3855  76% 2023-07-20 09:37 e82f5fe3  libchrony/message.c     2946  Defl:N     1099  63% 2023-07-20 09:37 945ee82b  libchrony/message.h --------          -------  ---                            -------    64485            20595  68%                            10 files 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 86k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You mean like this? Uri baseUri = new Uri("http://www.contoso.com"); Uri… May 11, 2026 at 5:27 pm
  • Editorial Team
    Editorial Team added an answer params[:action] you may need to update your render line to… May 11, 2026 at 5:27 pm
  • Editorial Team
    Editorial Team added an answer You need to use - (BOOL)openURL:(NSURL *)url in UIApplication. UIApplication… May 11, 2026 at 5:27 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.