git-archive vs. cp

2020-04-12 07:27发布

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 cp
1条回答
等我变得足够好
2楼-- · 2020-04-12 07:49

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.

查看更多
登录 后发表回答