Git-如何将本地存储库提交到另一个本地存储库的子文件夹? [英] Git - How to commit a local repository to a subfolder of another local repository?

查看:94
本文介绍了Git-如何将本地存储库提交到另一个本地存储库的子文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Django项目,该项目是我前一段时间开始的,当时我将其托管在bitbucket上.现在,我需要在openshift上托管它,并且这样做的方法是它们为您提供一个git存储库,并且每次您推送它们时它们都会自动部署.问题在于该存储库带有几个用于配置和设置的顶级文件夹,并且有效的django项目必须位于名为wsig/openshift的子文件夹中.

I have a Django project that I've started some time ago and I was hosting it at bitbucket. Now I need to host it at openshift, and the way to do that is that they provide you with a git repository and every time you push they deploy automatically. The problem is that the repository comes with several top-level folder for configuration and setup, and the effective django project must be inside a subfolder called wsig/openshift.

我的问题是,如何将我的更改从本地django存储库提交到本地openshift存储库的wsig/openshift子文件夹?因为我打算继续在bitbucket/本地存储库上进行开发

My question is, how can I commit my changes from my local django repository to the wsig/openshift subfolder of my local openshift repository? Because I intend to continue to develop on the bitbucket/local repository

推荐答案

您可能正在寻找子模块.从文档中:

You are probably looking for submodules. From the docs:

子模块允许将外部存储库嵌入到 源树的专用子目录,始终指向 特定的提交.

Submodules allow foreign repositories to be embedded within a dedicated subdirectory of the source tree, always pointed at a particular commit.

因此您将通过运行运行并且将bitbucket存储库作为单独的存储库嵌入到openshift存储库的子文件夹中

So you would do and would have the bitbucket repository as a seperate repository embedded in a subfolder of the openshift repository by running

git submodule add path_to_bitbucket folder/in/openshift

在openshift存储库中.

in the openshift repository.

您必须运行偶尔的git submodule update来保持openshift的最新状态,但是您可能已经期望进行这种额外的工作.

You will have to run an occaisonal git submodule update to keep openshift up to date but you probably already expected extra work of that sort.

这篇关于Git-如何将本地存储库提交到另一个本地存储库的子文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆