Questions tagged [git-archive]

For questions about git-archive, a Git sub-command used to create an archive from part of a Git repository. For example, it can create a tarball of the contents of a particular commit.

git archive is a sub-command used to create an archive, in various formats, from part of a Git repository. For example, it can create a tarball of the contents of a particular commit.

For usage information, see the git archive man page.

52 questions
2544
votes
31 answers

Do a "git export" (like "svn export")?

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: git clone followed by removing the .git repository directory. git…
Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
150
votes
6 answers

What does tree-ish mean in Git?

I'm very confused about how to use git archive. I have a git repository with folder Foo, Bar and Baz at the top level. I need to export folder Foo in a SVN-ish sort of way for quick test deployment. I learned that I could use git-archive in an…
dkinzer
  • 32,179
  • 12
  • 66
  • 85
64
votes
6 answers

how to close a branch in git

When I know I won't use a branch any more is it possible to close or lock it? Actually I would like to close a branch but I don't think it is possible to close a branch with GIT. what about the delete. What happens to my history when I delete a…
Matthieu
  • 653
  • 1
  • 5
  • 7
38
votes
2 answers

git archive fatal: Operation not supported by protocol

I'm trying to checkout part of remote git repository. As recommended here, with help of command git archive --format=zip --remote=http://path_to_repository But I'm getting error message: fatal: Operation not supported by protocol. Unexpected end…
Sly
  • 15,046
  • 12
  • 60
  • 89
34
votes
2 answers

git-archive a subdirectory --

I'm using git-archive to archive a subdirectory in a git repo, like so: git archive -o ../subarchive.zip HEAD subdir/* However the resulting archive maintains the subdir/ directory structure, i.e. the contents are: subdir/ whatever.js …
wildabeast
  • 1,723
  • 3
  • 18
  • 31
20
votes
7 answers

git archive export with submodules (git archive all / recursive)

I have a website directory versioned with git. I use submodules for required libraries like Twitter Bootstrap, colorbox and lessjs because I should not track the sourcecode but only the version of their code I use. Now I want to deploy the project…
kmindi
  • 4,524
  • 4
  • 31
  • 47
18
votes
5 answers

How do I exclude files from git archive?

Given a simple test repository with a single commit with two files, a and b, I can get a list of specific files: $ git ls-files a a Or a list of all files excluding specific files: $ git ls-files . ':!b' a I can create an archive of specific…
user743382
12
votes
2 answers

git archive : export-ignore, ignoring directories

I have a git repository with this .gitattributes: my_script.py export-subst Makefile export-ignore README.md export-ignore .gitattributes export-ignore .gitignore export-ignore hooks/ export-ignore tests/ export-ignore *.pyc export-ignore but when…
JuanPablo
  • 23,792
  • 39
  • 118
  • 164
9
votes
7 answers

git archive with unstaged changes

I'm building my own rpm's. Usually I use git archive to get a tarball from the commit or tag I'm interested in (suppose I have put a tag 1.0): git archive --format=tgz --prefix=product-1.0 1.0 > product-1.0.tgz suppose now I am doing some local…
Chris Maes
  • 35,025
  • 12
  • 111
  • 136
8
votes
3 answers

Git archive including the actual repository?

I need to create an archive of my Git project, ignoring and leaving out files specified by .gitignore, but including the actual .git repository folder. Simply running git archive master leaves out the .git folder. Is there a way to make git archive…
Naftuli Kay
  • 87,710
  • 93
  • 269
  • 411
6
votes
1 answer

Can git archive include the directory that the .git project lives in?

Can git archive include the directory that the .git project lives in? For example, let's say my directory structure is like this: -- /my-project-dir ----- /.git ----- /css ----- index.html ----- scripts.js By default, when I do a git archive, I end…
Pete
  • 7,289
  • 10
  • 39
  • 63
4
votes
3 answers

Export all commits into ZIP files or directories

How is it possible to export all commits into ZIP files (containing all files, not only patch/diff): myproject-commit1-67d91ab.zip myproject-commit2-9283acd.zip myproject-commit3-c57daa6.zip ... or into…
Basj
  • 41,386
  • 99
  • 383
  • 673
4
votes
1 answer

git archive --remote command using GitPython

How can I use command (git archive --remote) using GitPython? As per the GitPython docs we can use git directly. I am doing something like: git = repo.git git.archive(remote= 'http://path') But getting an error "Exception is : Cmd('git') failed due…
HCH
  • 49
  • 3
4
votes
3 answers

git archive : how to ignore pathspec during archive?

I am trying to create an archive of the files in the latest 3 commits using the following command. git archive -o archive.zip $(git diff --name-only HEAD~3) But in the last commit i deleted a few files, this is showing in the diff output. so i am…
bazi
  • 1,758
  • 5
  • 27
  • 41
4
votes
2 answers

How to append branch name and commit to git archive output file?

I'am using git archive to create a zip file with latest version/HEAD but would like to add the branch name and the commit to the zip filename. How can I achieve this?
Orlando
  • 368
  • 2
  • 9
1
2 3 4