简体   繁体   English

如何使用git共享项目的一部分

[英]how to share the part of the project using git

I have a project which I will share with my team. 我有一个项目,将与我的团队分享。 But I just want parts of the project to be shared. 但是我只想共享项目的一部分。

I have thougth use the branch. 我有思想的用途。 But it seems that it does not work. 但似乎它不起作用。

I have tried this: 我已经试过了:

git init
git add -A
git commit -m "first commit"
git checkout -b share
//delete files unshared
git add -A
git commit "commit at share branch"

Do I miss anything? 我想念什么吗?

You may create two separate repositories, one for the private code and second for the shared code. 您可以创建两个单独的存储库,一个用于私有代码,另一个用于共享代码。 Then using git submodules make the shared repository a part of your private repository. 然后使用git子模块使共享存储库成为私有存储库的一部分。 Submodules allow you to keep a repository as a subdirectory of another repository. 子模块允许您将一个存储库保留为另一个存储库的子目录。 This way all files will be managed by git and still you will be able to share a specific part of the project with others. 这样,所有文件都将由git管理,您仍然可以与他人共享项目的特定部分。

Just dont add those files to the git.Or make a gitignore file that specifies files and folders to ignore. 只是不要将这些文件添加到git中,或者制作一个gitignore文件来指定要忽略的文件和文件夹。 link 链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM