git-archive与cp [英] git-archive vs. cp

查看:272
本文介绍了git-archive与cp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

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

部署 / foo vs。只需从工作副本复制

  cp foo〜/ destination / foo 






所以,除非因为某些原因你不想要从主目录中的子目录foo复制所有内容,或者使用cp部署到[目标]就足够了。

解决方案

git archive 仅导出属于git存储库的项目。 cp 复制指定目录下的所有内容,包括 .git 目录,git忽略的文件等。

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.

解决方案

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.

这篇关于git-archive与cp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆