Einzelnen Beitrag anzeigen

Rollo62

Registriert seit: 15. Mär 2007
3.932 Beiträge
 
Delphi 12 Athens
 
#5

AW: [GIT] Organisation von Library-Varianten, Best practices

  Alt 11. Mai 2018, 14:53
Zitat:
By remembering this core concept and reflecting on it, you can understand that submodule support some workflows well and less optimally others. There are at least three scenarios where submodules are a fair choice:
  • A. When a component or subproject is changing too fast or upcoming changes will break the API, you can lock the code to a specific commit for your own safety.
  • B When you have a component that isn’t updated very often and you want to track it as a vendor dependency. I do this for my vim plugins for example.
  • C. When you are delegating a piece of the project to a third party and you want to integrate their work at a specific time or release. Again this works when updates are not too frequent.
Die Rede ist hier von submodules in einem main-modul (Projekt).
Wenn ich aber mehrere Branches in den submodules habe, wird dann die ganze Verwaltung nicht schnell zu undurchsichtig ?

Man könnte z.B. vielleicht auch eine Schicht dazwischenschalten, also
Delphi-Quellcode:
Projekt1 - submodule1 - branch feature1 -
                                          \
Projekt2 - submodule2 - branch feature2 -- submodule comon base
                                          /
Projekt3 - submodule3 - branch feature3 -
Wenn die submodules 1-3 quasi den master branch für das jeweilige Projekt darstellen.
Dann wären zumindest Projekte und Library sauberer getrennt, und Änderungen in submodule1 könnten (womöglich) leichter gewartet werden.

Update:
Ginge das nicht in die Richtung fork mit pull request ?
Würde sich das für ein internes GIT lohnen, oder ist der Aufwand zu hoch ?

Zitat:
This is a very common workflow: you start using someone else’s project as submodule but then after a while you find the need to customize it and tweak it yourself, so you want to fork the project and replace the submodule with your own fork. How is that done?

The submodules are stored in .gitmodules:

$ cat .gitmodules
[submodule "ext/google-maps"]
path = ext/google-maps
url = git://git.naquadah.org/google-maps.git

You can just edit the url with a text editor and then run the following:

$ git submodule sync

This updates .git/config which contains a copy of this submodule list (you could also just edit the relevant [submodule] section of .git/config manually).

Rollo

Geändert von Rollo62 (11. Mai 2018 um 15:02 Uhr)
  Mit Zitat antworten Zitat