0

ゲームとゲーム エディターの間でモデルを共有したいと考えています。ゲームは cocos2d フレームワークで開発され、c++ および Objective-C コードが含まれています。エディターは Qt で行われます (windows 7 atm で開発)。モデルは純粋な C++ です (プラットフォーム固有のものはありません)。

私は職場で同様の問題を抱えていましたが、共有コードをプロジェクトとしてエクスポートし、そのリポジトリを作成することで解決しました。次に、それをサブプロジェクトとして追加し、必要に応じて更新しますが、サブプロジェクトを Qt に追加できるかどうかはわかりません。実際には、エディタとゲーム リポジトリの両方のサブリポジトリである静的ライブラリ リポジトリのようなものですが、その方法がわかりません。

4

2 に答える 2

2

あなたが探しているのはGitサブモジュールのようです(私のものを強調してください):

あるプロジェクトで作業しているときに、その中から別のプロジェクトを使用する必要があることがよくあります。おそらく、サードパーティが開発したライブラリか、個別に開発して複数の親プロジェクトで使用しているライブラリです。これらのシナリオでは、共通の問題が発生します。2 つのプロジェクトを別々のものとして扱い、一方を他方から使用できるようにしたい場合...

Git は、サブモジュールを使用してこの問題に対処します。サブモジュールを使用すると、Git リポジトリを別の Git リポジトリのサブディレクトリとして保持できます。これにより、別のリポジトリをプロジェクトに複製し、コミットを別々に保つことができます

Git docs でサブモジュールの詳細を読むこともできます。

于 2013-07-09T05:56:30.670 に答える
1

Subtree merging is another alternative.

For the gory details behind the git-subtree script see this and this (in the order of increasing hardcore-ness).

To cite the latter manual:

There are situations where you want to include contents in your project from an independently developed project. You can just pull from the other project as long as there are no conflicting paths.

The problematic case is when there are conflicting files. Potential candidates are Makefiles and other standard filenames. You could merge these files but probably you do not want to. A better solution for this problem can be to merge the project as its own subdirectory. This is not supported by the recursive merge strategy, so just pulling won’t work.

What you want is the subtree merge strategy, which helps you in such a situation.

The git-subtree script (which is included with Git in its contrib section in its relatively modern versions) facilitates subtree merges.

于 2013-07-09T14:03:55.433 に答える