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
3
votes
0 answers

How to ignore files/directories in "git archive" and only create an archive of a subdirectory?

TL;DR: The git archive command seems to only either archive a single subdirectory or adhere to .gitattributes and exclude files/directories from the resulting ZIP, but cannot do both. Say I have this directory structure in my git archive (simplified…
rugk
  • 4,755
  • 2
  • 28
  • 55
3
votes
1 answer

Git: get specific revision from remote server

I'm setting up a test-architecture. In this system a VM has to test a specific revision of the code. The VM is completely clean, and does not have a local (updatable) version of the repo. The code is being hosted on an on-site git server, over ssh…
Claude
  • 8,806
  • 4
  • 41
  • 56
3
votes
1 answer

Clone the latest version of a git repository through https

I would like to get some files from a project : I do not need to clone the entire repository : I need only the latest snapshot from the master branch. This is important for me because, my bandwidth is quite low, it takes some time to download…
Eric
  • 5,101
  • 10
  • 37
  • 45
2
votes
0 answers

Git-Archive Read Paths From a File or STDIN Instead of CLI Argument in Windows

I need to create an archive of changed files only between two commits. I use this command: git archive -o changes.zip HEAD $(git diff --name-only --diff-filter=d a1be79f0 HEAD). It works fine for small amount of changes. But now I have added a new…
Chitholian
  • 432
  • 1
  • 10
  • 19
2
votes
0 answers

git archive entire repo regardless of my current working directory

I want to use git archive anywhere in the repo and include the entire repo. name@host:~/repo$ git archive HEAD -o /path/to/archive/repo.tar.gz The above command will work fine ONLY when my working directory is the repo root. When I am working at…
Minoru
  • 512
  • 3
  • 12
2
votes
2 answers

Exporting changed and added files from a bare repo with no working-tree to a directory for compilation or deployment

I have a bare repo that developers push their hotfix branches to from their local repo on Windows. When the branch is pushed I trigger a hook to build their changes on Linux. This is easy to do if I create a working-tree for the branch. However, the…
Westend
  • 41
  • 4
2
votes
2 answers

Use git archive instead of clone with credentials in jenkins pipeline job

On my Jenkins pipeline job, I used to clone git repo at the begining of my job like that cleanWs() git branch: 'master', credentialsId: 'SSH_GIT', url: 'git@myserver.com:myrepo' Note that I need credentials. In order to reduce time execution and…
Flows
  • 3,675
  • 3
  • 28
  • 52
2
votes
1 answer

Git copy only specific files from remote

I am trying to understand how (and if it is possible) to copy only specific files of a specific directory from remote in Git. (not interested in continuing working on those files or getting the history) For example, say the remote master branch…
Yannis
  • 1,682
  • 7
  • 27
  • 45
2
votes
1 answer

How do you git archive a branch using gzip with highest compression level?

I'm trying to git archive a branch using gzip with the highest level compression (9) but it seems to not compress at that level. Here is my command: git -C /home/user/example.com/ archive --format tar -o /home/user/site_backups/develop-`date…
Daniel Harris
  • 1,805
  • 10
  • 45
  • 63
2
votes
1 answer

git Bad file number

I've been trying to git archive a new version of the system I'm currently working on, but, suddenly, the git archive command, which I used to use, stopped working. I use the git archive followed by the git diff + filters, that is necessary only to…
Armando Freire
  • 417
  • 2
  • 7
  • 19
1
vote
0 answers

How to include node_modules in git archive ZIP?

I have added node_modules in .gitignore as usual, because I want to keep it out of my repository. However, I use git archive to create a production ZIP that I upload to AWS Elastic Beanstalk and I want to include the node_modules so that they don't…
dodov
  • 5,206
  • 3
  • 34
  • 65
1
vote
0 answers

How to ignore not-matching pathspecs?

A script which just wants a lean copy of the current state from the server to process further does this as an alternative to a shallow clone: git archive --remote=ssh://example.com/repo.git --output=repo.tar.gz HEAD -- "*.hpp" "*.cpp" "*.inc" If…
Borph
  • 842
  • 1
  • 6
  • 17
1
vote
1 answer

Get artifacts from previous GIT jobs

I have a 3 stages in pipeline, each job in all 3 stages are creating a xml data files. These jobs which runs in parallel. I want to merge all xml data file in 4th stage. Below is my yml code stages: - deploy - test - execute -…
itin
  • 430
  • 3
  • 9
  • 20
1
vote
2 answers

How do I preserve timestamps with git archive

I use a post-commit script to 'git archive' to a temp directory, then I use Rsync to move just the changed files to my dev working directory. I am preserving timestamps with rsync, but the git archive command updates all the timestamps to current…
Doug Wolfgram
  • 2,064
  • 4
  • 27
  • 42
1
vote
3 answers

Create git archive from repo without a commit

There is the git archive command - is there a way to create a tarball from a repo without making a commit? Essentially I just want to create tarball of the existing files (more importantly honoring gitignore). I assume git archive is looking for a…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817