简体   繁体   English

在结构化 github 存储库中创建和推送文件

[英]creating and pushing files in a structured github repository

How can I create a sub-folder (with files) using terminal in a github project, knowing that I'll work on those files and push them to the sub-folder of that specific project/directory?如何在 github 项目中使用终端创建子文件夹(包含文件),知道我将处理这些文件并将它们推送到该特定项目/目录的子文件夹?

For example:例如:

myproject
    |_work00 (to push changes in this folder)  
    |_work01
    |_work02

Any idea by any chance?!有任何想法吗?

Thanks in advance!提前致谢!

First, if you have only one GitHub repository, you can simply add files in your subfolders, and push from anywhere within myproject : said files will appear on the remote GitHub " myproject " repository.首先,如果您只有一个 GitHub 存储库,您可以简单地在子文件夹中添加文件,然后从myproject中的任何位置推送:所述文件将出现在远程 GitHub“ myproject ”存储库中。

But, second, if you want one GitHub repository per workxx folder, you can create them on GitHub, and then, in the myproject repository, add them as submodules .但是,其次,如果您希望每个workxx文件夹都有一个 GitHub 存储库,您可以在 GitHub 上创建它们,然后在 myproject 存储库中将它们添加为子模块

cd /path/to/myproject
git submodule add https://github.com/<me>/work00

You can then work in those submodule, add, commit and push from each one.然后,您可以在这些子模块中工作,从每个子模块中添加、提交和推送。

But you will also have to add, commit and push from myproject , in order to register those submodules new state.但是您还必须从myproject添加、提交和推送,以便注册这些子模块新的 state。

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

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