4

現在、SVN から Git に移行中です。コード ベースは、10 ~ 15 モジュールの大規模な Maven プロジェクトです。以前は、各モジュールのレポがありました。

次のユースケースを処理するには、Git リポジトリにどのようなアーキテクチャが必要なのだろうか:

  • ユーザーは 1..N 個のモジュールをチェックアウトできます。
  • John はモジュール M をコミットしてプッシュします。Emma はスーパーフォルダーから変更をプルします。
  • John は、スーパーフォルダーからモジュール M の変更をコミットしてプッシュします。Emma はモジュール フォルダーから変更をプルします。
  • John は (git mv を使用して) ファイル A を M1 から M2 に移動し、コミットしてプッシュします。Emma edits file A update before commit. Emma の変更に伴い、ファイルが移動しました。

「単一リポジトリ」アーキテクチャを考えましたが、UC#1 は処理されません。「submodule」、「subtree」、および以前の「one-module-one-repo」は UC#4 を処理できません。

さらに、ユースケースのほとんどが「サブモジュール」アーキテクチャによって処理される場合、導入する複雑さをできるだけ少なくしたいと考えています。サブモジュールは、切り離されたヘッドのような概念を導入し、より頻繁なエラーの後に痛みを伴う修復を引き起こす可能性があります.

私は広範な検索を行いましたが、複雑になりすぎずにそれが可能かどうかはわかりませんが、回避策を見つけた人がいるはずです.

注意: 現在の SVN アーキテクチャでは、このユース ケースを処理できません。

どうもありがとう、マキシム。

4

2 に答える 2

3

あなたの分析は正しいです。これらすべてのユース ケースに一度に対処する明白な方法はありません。2つのアプローチのいずれかをお勧めします。

  1. モジュールを個別にチェックアウトするという最初の要件は、実際には必要ない場合があります。git を使用すると、最初のクローンを作成するときにチェックアウトの費用が 1 回だけかかりますが、その後の増分更新は非常に高速です。
  2. おそらくそれぞれに独自のリリース サイクルがある Maven モジュールを扱っている場合、モジュールにはソース レベルの関係が本当に必要なのでしょうか? そうでない場合、モジュールの依存関係は Maven だけで表すことができます。

実際には、単一のリポジトリから始めて、後で必要に応じて分割する必要があります。しかし、おそらくそうではないでしょう。:)

于 2012-07-17T12:18:40.930 に答える
1

you can't have all that. not on GIT and not on SVN.

you've already realized that your requirements conflict with each other and even admitted that your current setup does not cover all the situations so you should change the way you're approaching this problem.

instead of demanding certain capabilities from the tool try to explain what are the actual problems that need to be solved and allow people to suggest ways to solve them, chances are those won't be things you've already considered.

I'll try now to answer the problems you've shown on the comments and completely ignore your initial request, I hope it helps more with the actual situation you're in.

we cannot afford a timeline where the commit messages of every (10-15) modules display in the same place

unlike SVN, in GIT you have branches (real branches) and each branch will have its own history so as long as your devs use branches and you merge them instead of using rebase you should be able to isolate each branch log with the appropiate commands, see git log --graph to get the idea.

currently merges are anxiogenic and therefore developers try to avoid merges as often as possible

there's no real solution for this but there's ways to mitigate the problem.

one way is to have several clones of the repo along with the master copy, if your team is about 40 people and you have 10-15 modules then I guess you have small teams there that focus in particular areas/modules; if that's the case then each subteam should have its own clone of the repo and merge locally there before merging back to the master copy.

this approach effectively splits the merge process (and the responsibility) in two phases, one that concerns the changes within the subteam and another that deals with the interaction with the rest of the modules.

But I must keep the use case 4 (move and edit) to give Git a clear lead in the developer eyes and tame that fear of merge

I'll be completely honest, UC#4 is impossible*. particularly on GIT where the mv operation is actually a composition of rm and add.

perhaps if the addition happens before the movement some (d)VCS can figure it out but I don't think that's the case for GIT, even so I think you're taking the wrong way to "tame that fear of merge" let me explain.

* @sleske suggests to check this thread for a way to do UC#4

the reason people fear the merge is because they don't understand it and SVN forces you to merge upstream (that is, on the server) which adds pressure, the problem with your approach is that by trying to help them avoid it you're reinforcing the idea that merges are something obscure and dangerous that should be avoided, don't do that.

if you want them to get over the fear you need to train them so they have the tools to deal with the situation, in other words don't help them avoid the problem force them to solve it, teach them about all the merges and conflict styles, tell them about rerere, even teach them the octopus merge which I've never used but what he hell teach them that too! and then MAKE them practice so it becomes something they know and can handle.

merges in GIT aren't as stressful as with SVN because they're also local so you can do them as many times as you want without fear of screwing other peoiple's environment, you'll only push them once you're absolutely sure they're ok.

that's all for now, if you have additional concerns add a comment and I'll see if I have an idea, good luck!

于 2012-07-18T02:40:37.927 に答える