简体   繁体   English

如何只从特定的遥控器中排除文件夹?

[英]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. 如果folder1folder2不相关,则应考虑为每个文件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.

相关问题 如何仅从Git中的根文件夹中排除文件 - How to exclude file only from root folder in Git 全局 gitignore - 如何排除单个特定文件夹 - Global gitignore - how to exclude a single specific folder 如何从远程仓库克隆特定文件夹而不浪费 .svn 文件夹上的数据? - How to clone a specific folder from remote repo without wasting data on .svn folder? 是否可能只从远程存储库克隆一个文件夹? - Is possible clone only a folder from remote repository? Git仅从远程复制特定文件 - Git copy only specific files from remote 意外提交带有情节的文件夹 - 如何从未来的提交中排除此文件夹? - accidentally comitted folder with plots - how to exclude this folder from future comits? 如何根据特定日期将文件从远程git存储库提取到本地文件夹? - How to fetch files from a remote git repository to a local folder, based on specific date? 如何将特定文件夹从来源(远程存储库)拉入本地主存储库 - How can i pull a specific folder from origin (Remote repository) into my local master repository 如何从更新中排除特定的git子模块? - How to exclude a specific git submodule from update? Git仅从特定文件夹合并 - Git merge from a specific folder only
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM