Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Git to create an archive of changed files

Tags:

git

I am looking for a simple solution to make a archive of recent changed file.

I get this simple command from google

git archive -o update.zip HEAD $(git diff --name-only HEAD^)

When I run it in GIT BUSH, it keeps saying saying fatal: Not a valid object name

like image 401
Kuroro Avatar asked Apr 05 '12 04:04

Kuroro


1 Answers

I'm using this answer in that case that tells me to

tar czf changed-files.tar.gz `git diff --name-only [diff options]`

For example, to create an archive containing the files changed in the last four revisions, I'd do

tar czf changed-files.tar.gz `git diff --name-only HEAD~4..`

This assumes – of course – that HEAD~4 does actually exist.

like image 108
eckes Avatar answered Oct 02 '22 20:10

eckes