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

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

问题描述

使用的好处是什么

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

部署/foo的副本 vs. 只是从工作副本中复制

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

cp foo ~/destination/foo

<小时>

因此,除非出于某种原因,您不想从 master 中的子目录 foo 复制所有内容(或您碰巧正在处理的任何分支),否则使用 cp 部署到 [destination] 就足够了.


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 仅导出属于 git 存储库的项目.cp 复制指定目录下的所有内容,包括.git 目录,git 忽略的文件等.

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天全站免登陆