Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-archive vs. cp

Tags:

git

cp

archive

What is the advantage of using

git archive master/foo | tar -x -C ~/destination

to deploy a copy of /foo vs. just copying from the the working copy with

cp foo ~/destination/foo

So, unless for some reason you don't want to copy everything over from that sub directory foo in master (or whatever branch you happening to be working on), using cp for deploying to a [destination] would suffice.

like image 773
dkinzer Avatar asked Feb 11 '26 20:02

dkinzer


1 Answers

git archive only exports items that are part of the git repository. cp copies everything that's under the specified directory, including the .git directory, files which are ignored by git, etc.

like image 52
jamessan Avatar answered Feb 13 '26 15:02

jamessan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!