git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Can I zip a git repo without losing anything?

From
Andrew Ardill <andrew.ardill@gmail.com>
Date
Nov 26, 2012, 05:06 UTC
Message-ID
<CAH5451n4EQ16-bpKGiDZMu42ewSX_Jeg3Z9mcCHvvBv-xzoTfw@mail.gmail.com>
In-Reply-To
<CAP-uhDcQg0BuEdHDTa6qVqLCeB-LE1GZtEqHgY_j1--XodsDKw@mail.gmail.com>
On 26 November 2012 15:55, Carl Smith <carl.input@gmail.com> wrote:
Show 9 quoted lines
> Hi all
>
> This is my first post to this list, so thank you for all your work.
>
> After suggesting using zip files to move our projects around, I was
> told that you can not zip a git repo without loosing all the history.
> This didn't make sense to me, but two people told me the same thing,
> so I wasn't sure. I think they may have been confusing the zipped file
> you can download from GitHub with a zipped git repo.
Hi Carl,
The basics of it are as follows, a little simplified to hopefully make it clear

Git uses a working directory that contains the files which you are working on. These get converted into a snapshot when you commit, and these commits form the history of your project. These snapshots along with everything else that git needs to work are stored in the git directory, often called ".git".

When you zip the files you are working on you are creating a manual snapshot of your project. If you zip the git directory you are compressing the entire git repository and this has enough information to recreate your entire history. If you zip both of them you get your history as well as any changes that have not been committed yet. When a server holds a copy of your repository it will not include a working directory at all, but instead just the git directory. In this situation the git directory will often be called the same name as the project.

The zip from GitHub does indeed only contain the working directory, and so doesn't include the history.

Hope that helps!
Regards,

Andrew Ardill Regards,

Andrew Ardill
Previous: Carl SmithNext: Konstantin Khomoutov
Message 2 of 3 in “Can I zip a git repo without losing anything?”
  1. Carl SmithNov 26, 2012
  2. Andrew ArdillNov 26, 2012
  3. Konstantin KhomoutovNov 26, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.