[英]How to exclude folder only from specific remote?
I have two folder: 我有两个文件夹:
/folder1
/folder2
I have to remotes: 我要遥控器:
/origin1
/origin2
I want that origin1 will contain the both folders. 我希望origin1将包含两个文件夹。 I want that origin2 will never have
folder2
. 我希望origin2永远不会具有
folder2
。
Is it possible? 可能吗? If not, what is your workaround for that?
如果不是,您的解决方法是什么?
(I want that someone will pull from origin2
only folder1
and push only to folder
') (我想会有人从拉
origin2
只有folder1
,只推到folder
“)
That is not possible. 这是不可能的。
Git tracks the content of the whole repository, and commits are “snapshots” of working directory. Git跟踪整个存储库的内容,而提交则是工作目录的“快照”。 So one commit will always contain the full folder and file structure including the file's contents.
因此,一次提交将始终包含完整的文件夹和文件结构,包括文件的内容。 It is not possible to have one commit represent two different states.
一个提交不可能代表两种不同的状态。 That would result in two different commit objects.
那将导致两个不同的提交对象。
If folder1
and folder2
are unrelated, you should consider making separate repositories for each. 如果
folder1
和folder2
不相关,则应考虑为每个文件folder2
创建单独的存储库。 So you would push the folder1
repository to both remotes, and only folder2
to the second remote. 因此,您可以将
folder1
存储库推到两个远程服务器,而仅将folder2
推到第二个远程服务器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.