How to partially export a git repository?

北慕城南 提交于 2019-12-04 15:55:59

You could use git-filter-branch to extract the parts you want to import to Google Code.

In git 1.7.11, we use a command like this to export just the raw files of one directory in the repository, without exporting the git control and history. Be sure to run it in an existing directory where you want the files to appear (i.e. make and cd to the destination directory first):

git archive --remote /local/master/project.git HEAD:open/src | tar x
  • Replace /local/master/project.git with whatever you use to specify your repository (my example uses a local NFS master)
  • replace HEAD with the branch name
  • replace open/src with the directory within the repository to export

Using the --remote option, you don't even need to run this in a cloned copy, so it can be embedded within any other processes you wrap around your release mechanism.

You can further use the tar options to exclude some files from the selected directory tree.

One approach might be to create a separate Git repository for the public stuff, and include that as a submodule in the internal repository. Then it will be a lot easier to synchronise the public Git repository with the Google Code SVN repository.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!