Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use git-archive to include submodules from a bare repository

I'm in the process of setting up a deployment script. The basic process is:

  1. Push changes to a bare repository on the server
  2. Then based on new tags will create a new folder for the release.
  3. Use git archive to move the files into the release directory
  4. Runs some migrations scripts and puts it live (if all is successful).

The issue is my repository contains a submodule, which doesn't get put in the archive, and therefore doesn't get put in the release directory.

I've seen git-archive-all, but that doesn't work on a bare repository.

If its not possible, I'm considering,

  1. making the repository not bare, and updating the working copy, which would allow me to use git-archive-all. Or
  2. having a second bare repository of the submodule on the server, which I could get an archive from (would have to look into this to make sure I'm getting the right revision).
like image 717
Jacob Avatar asked Mar 30 '11 06:03

Jacob


People also ask

How do I add a git submodule to an existing project?

In order to add a Git submodule, use the “git submodule add” command and specify the URL of the Git remote repository to be included as a submodule. When adding a Git submodule, your submodule will be staged. As a consequence, you will need to commit your submodule by using the “git commit” command.

How does git store submodules?

It is stored in Git's object database directly. The tree object for the directory where the submodule lives will have an entry for the submodule's commit (this is the so-called "gitlink").

Does git pull include submodules?

Pulling with submodules. Once you have set up the submodules you can update the repository with fetch/pull like you would normally do. To pull everything including the submodules, use the --recurse-submodules and the --remote parameter in the git pull command .

What is git archive used for?

Git archive is a helpful utility for creating distributable packages of git repositories. Git archive can target specific refs of a repository and only package the contents of that ref. Git archive has several output formats that can utilize added compression.


1 Answers

I use this python package https://github.com/Kentzo/git-archive-all. You can install it by using

pip install git-archive-all 

On OSX, you can install it also using brew install git-archive-all

like image 156
ismailsunni Avatar answered Oct 03 '22 04:10

ismailsunni