Git Teilbaum im Detail

Bei der Entscheidung, dieses oder jenes Tool in seinen eigenen Projekten zu verwenden, muss der Ingenieur nicht nur die unterstützende Dokumentation studieren, sondern auch eine Reihe von Experimenten durchführen, um potenzielle Probleme in Zukunft zu vermeiden. Wenn es sich um eine langfristig konzipierte CM-Richtlinie handelt, wird der Preis für den Auswahlfehler ziemlich hoch.


In diesem Dokument wird das Git- Teilbaum-Verwaltungstool geübt.



Ab Version 1.7.11 enthält das Git- Upstream-Repository im Verzeichnis contrib / subtree ein Tool zur Automatisierung der Arbeit mit Teilbäumen .


Der Dienst git-subtree (1) ist tatsächlich ein nützliches Add-In, das die Funktionen git-read-tree (1) und git-write-tree (1) verwendet. Daher fügen die Links im Git-Teilbaum (1) Befehle hinzu / ziehen / drücken :

git subtree add --prefix=<subdir> <remote> <ref> 

kann entweder Zweigstellennamen oder Tag-Namen eines Remote-Repositorys sein.


Wenn Sie das Remote-Repository im Voraus mit dem folgenden Befehl zur Konfigurationsdatei des lokalen Repositorys .git / config hinzufügen:


 bash-4.4$ git remote add build-system ../../remote/build-system.git 

Wenn build-system der Name des Remote-Repositorys ist ../../remote/build-system.git , können wir in Zukunft bei Verwendung der Befehle add / pull / push von git-subtree (1) auf das vorgelagerte Remote- / Repository verweisen build-system.git nach Namen.


Derzeit entwickelt sich git-subtree (1) praktisch nicht, sondern wird nur für den aktuellen Entwicklungsstand des Git- Projekts auf dem neuesten Stand gehalten.


Git-Teilbaum (1) ist jedoch das beliebteste und leistungsfähigste Werkzeug für die Arbeit mit Teilbäumen.



Testumgebung


Im vorherigen Artikel zu git-subrepo (1) haben wir eine einfache Verzeichnisstruktur mit Test-Repositorys verwendet, um zu demonstrieren, wie die Funktionen in der Praxis funktionieren. Jetzt reproduzieren wir die folgende Umgebung:


 bash-4.4$ vim _init.sh #!/bin/sh CWD=`pwd` mkdir remote owner user cd remote git init --bare build-system.git git init --bare platform.git cd ../owner git clone $CWD/remote/build-system.git git clone $CWD/remote/platform.git cd build-system echo -e "\n[master] build-system 1.0.0\n" >README git add README git commit -m "init build-system master 1.0.0" git push cd ../platform echo -e "\n[master] platform 1.0.0\n" >README git add README git commit -m "init platform master 1.0.0" git push cd ../../user git clone $CWD/remote/build-system.git git clone $CWD/remote/platform.git cd $CWD :wq bash-4.4$ chmod a+x ./_init.sh bash-4.4$ ./_init.sh bash-4.4$ 

Hier


Besitzer- -Arbeitsverzeichnis des Projektautors;
Fernbedienung- -Ein Verzeichnis, das den Server des Autors der Projekte darstellt, auf dem sich die vorgelagerten Repositorys der Hauptprojektplattform.git und des Unterprojekts build-system.git befinden .
Benutzer- -Arbeitsverzeichnis für einen Benutzer oder ein Mitglied eines Entwicklungsteams

Als Ziel der Untersuchung der Fähigkeiten von git-subtree (1) werden wir dieselben Aufgaben betrachten, über die wir im Git Subrepo- Artikel gesprochen haben, wobei jedoch die Unterschiede zwischen den beiden Tools berücksichtigt werden.



Teilbaum verbinden


Merken Sie sich den aktuellen Status des Repositorys remote / platform.git :


 bash-4.4$ bash-4.4$ cd owner/platform/ bash-4.4$ git log commit 7fad4becbd13258216fb95cbe9d987dd33f0be6d (HEAD -> master, origin/master) Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init platform master 1.0.0 bash-4.4$ 

und verbinden Sie den Hauptzweig des Upstream-Repositorys remote / build-system.git mit dem Verzeichnis build-system:


 bash-4.4$ bash-4.4$ git subtree add --prefix=build-system ../../remote/build-system.git/ master git fetch ../../remote/build-system.git/ master warning: no common commits remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ../../remote/build-system * branch master -> FETCH_HEAD Added dir 'build-system' bash-4.4$ 

Betrachten Sie den neuen Status der lokalen Kopie des Repositorys remote / platform.git :


 bash-4.4$ bash-4.4$ git log --graph * commit 47905bcb80be6f7cb3030513986fad4df548f812 (HEAD -> master) |\ Merge: 7fad4be 783c6d5 | | Author: user <___@_______> | | Date: Thu Nov 1 20:20:20 2018 +0300 | | | | Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d | | git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: master | | | * commit 783c6d5af1100e9665f930c818c861ff011bed19 | Author: user <___@_______> | Date: Thu Nov 1 20:16:33 2018 +0300 | | init build-system master 1.0.0 | * commit 7fad4becbd13258216fb95cbe9d987dd33f0be6d (origin/master) Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init platform master 1.0.0 bash-4.4$ 

Hier sollten Sie auf die Meldung achten, dass der Befehl git-subtree (1) add übrig bleibt. Mit diesem Befehl setzen wir den Unterschied in das Plattform- Repository:


 bash-4.4$ bash-4.4$ git diff 7fad4becbd13258216fb95cbe9d987dd33f0be6d 47905bcb80be6f7cb3030513986fad4df548f812 diff --git a/build-system/README b/build-system/README new file mode 100644 index 0000000..73a41c7 --- /dev/null +++ b/build-system/README @@ -0,0 +1,3 @@ + +[master] build-system 1.0.0 + bash-4.4$ 

Wenn die Änderungshistorie etwas weiter geht, werden wir die Details zum Verbinden von Teilbäumen genauer untersuchen und nun unsere Änderungen in das Upstream-Repository remote / platform.git einfügen :


 bash-4.4$ bash-4.4$ git push Enumerating objects: 6, done. Counting objects: 100% (6/6), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 582 bytes | 582.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To ../../remote/platform.git 7fad4be..47905bc master -> master bash-4.4$ 

und schau noch einmal auf den git-Teilbaum (1) Befehlsposten hinzufügen :


  Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' git-subtree-dir: build-system git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 git-subtree-repo: ../../remote/build-system.git/ git-subtree-ref: master 

Diese Meldungen sind nützlich, damit Sie bei Bedarf den Verbindungsverlauf und den aktuellen Status des Teilbaums ermitteln können. Der ursprüngliche Befehl git-subtree (1) fügt die letzten beiden Zeilen der Nachricht nicht hinzu. Wir haben dieses Dienstprogramm geringfügig geändert, um die Suche nach Informationen darüber zu erleichtern, wann und aus welchem ​​Zweig des Remote-Repositorys dieser oder jener Teilbaum unseres Projekts erstellt wurde.


Sie können die vollständige Diff-Datei unserer Änderungen wie folgt abrufen:


 bash-4.4$ bash-4.4$ git clone https://github.com/radix-platform/git.git bash-4.4$ cd git bash-4.4$ git checkout git-subtree-2.19.1 bash-4.4$ git diff v2.19.1 > ../git-subtree-2.19.1.patch bash-4.4$ 

Um unsere Beispiele realistischer zu gestalten, werden wir Änderungen am Upstream-Repository remote / build-system.git vornehmen:


 bash-4.4$ bash-4.4$ cd owner/build-system/ bash-4.4$ vim README bash-4.4$ cat README [master] build-system 1.0.1 bash-4.4$ 

Speichern Sie diese Änderungen:


 bash-4.4$ bash-4.4$ git add README bash-4.4$ git commit -m "update build-system version to 1.0.1" [master e5c5446] update build-system version to 1.0.1 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

und übergeben Sie sie an das Upstream-Repository remote / build-system.git :


 bash-4.4$ bash-4.4$ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 274 bytes | 274.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ../../remote/build-system.git 783c6d5..e5c5446 master -> master bash-4.4$ 

Daher wurde die Revision des Build-System- Repositorys von 783c6d5 auf e5c5446 geändert:


 bash-4.4$ bash-4.4$ git log commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 (HEAD -> master, origin/master) Author: user <___@_______> Date: Thu Nov 1 20:26:52 2018 +0300 update build-system version to 1.0.1 commit 783c6d5af1100e9665f930c818c861ff011bed19 Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init build-system master 1.0.0 bash-4.4$ 

Erinnern Sie sich an diesen Status und fahren Sie mit der Arbeit mit dem Container-Repository remote / platform.git fort .



Abrufen von Änderungen aus einem Upstream-Teilbaum-Repository


Nehmen wir an, wir wissen immer noch nichts über Änderungen im Upstream-Repository des Teilbaums und arbeiten an der Verbesserung des Plattformcodes :


 bash-4.4$ bash-4.4$ cd owner/platform/ bash-4.4$ vim README bash-4.4$ cat README [master] platform 1.0.1 bash-4.4$ bash-4.4$ git add README bash-4.4$ git commit -m "update platform version to 1.0.1" [master 442c9e9] update platform version to 1.0.1 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ bash-4.4$ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 306 bytes | 306.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ../../remote/platform.git 47905bc..442c9e9 master -> master bash-4.4$ 

Als Ergebnis unserer Arbeit haben wir den folgenden Status des Repositorys remote / platform.git erhalten :


 bash-4.4$ bash-4.4$ git log --graph * commit 442c9e94c9890032fb2f3123661345d465e2849f (HEAD -> master, origin/master) | Author: user <___@_______> | Date: Thu Nov 1 20:41:40 2018 +0300 | | update platform version to 1.0.1 | * commit 47905bcb80be6f7cb3030513986fad4df548f812 |\ Merge: 7fad4be 783c6d5 | | Author: user <___@_______> | | Date: Thu Nov 1 20:20:20 2018 +0300 | | | | Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d | | git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: master | | | * commit 783c6d5af1100e9665f930c818c861ff011bed19 | Author: user <___@_______> | Date: Thu Nov 1 20:16:33 2018 +0300 | | init build-system master 1.0.0 | * commit 7fad4becbd13258216fb95cbe9d987dd33f0be6d Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init platform master 1.0.0 bash-4.4$ 

Nun wäre es schön zu wissen, was im Upstream-Repository des Build-System- Teilbaums passiert ist, während wir daran gearbeitet haben, den Code im Haupt-Repository unseres Projekts zu verbessern. Scrollen Sie zuerst mit dem Befehl git subtree --list durch die Teilbäume:


 bash-4.4$ bash-4.4$ git subtree --list build-system ../../remote/build-system.git/ branch master HEAD bash-4.4$ 

Dieser Befehl zeigt in einem einfachen Format das Teilbaumverzeichnis, die URL des Upstream-Repositorys des Teilbaums, die Art des Links (Zweig oder Tag), den Namen des Links sowie die Überarbeitung des angegebenen Zweigs oder Tags des Repositorys an, dessen Code wir in unseren Teilbaum einfügen. Wir erinnern uns jedoch daran, dass die Entwicklung des Teilprojekts Build-System fortgesetzt wurde und das Zeigen auf den Kopf des Hauptzweigs nicht mehr gültig ist. Dies ist vielmehr eine Nachricht darüber, was wir in unserem Repository haben möchten, und nicht über den tatsächlichen Stand der Dinge.


Um herauszufinden, wie weit der Code im Upstream-Repository eines Teilbaums fortgeschritten ist, müssen wir auch durch die Teilbäume scrollen, aber die Option -d verwenden :


 bash-4.4$ bash-4.4$ git subtree -d --list Looking for externals... Commit: 47905bcb80be6f7cb3030513986fad4df548f812 build-system ../../remote/build-system.git/ branch master HEAD The 'build-system' subtree seems not updated: original revision: 783c6d5af1100e9665f930c818c861ff011bed19 remote revision: e5c5446967599065dc02a269d8fcfc2c1d3c4f65 You can update 'build-system' subtree by following command: git subtree pull --prefix=build-system ../../remote/build-system.git/ master bash-4.4$ 

Die Ausgabe legt nahe, dass während der Arbeit am Code des Hauptrepositorys der Hauptzweig des Upstream-Repositorys des Teilbaums des Build-Systems ausgeführt wurde . Darüber hinaus hat der Befehl git subtree -d --list einen Hinweis ausgegeben, dass wir Änderungen am Upstream-Subtree-Repository wie folgt erhalten können:


 bash-4.4$ bash-4.4$ git subtree pull --prefix=build-system ../../remote/build-system.git/ master remote: Enumerating objects: 5, done. remote: Counting objects: 100% (5/5), done. remote: Total 3 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. From ../../remote/build-system * branch master -> FETCH_HEAD hint: Waiting for your editor to close the file... 

Dieser Befehl öffnet den Editor mit dem Nachrichtentext, da wir -m "Festschreibungsnachricht" nicht angegeben haben:


Merge Commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65'

# Bitte geben Sie eine Commit-Nachricht ein, um zu erklären, warum diese Zusammenführung erforderlich ist.
# insbesondere, wenn ein aktualisierter Upstream in einem Themenzweig zusammengeführt wird.
#
# Zeilen, die mit '#' beginnen, werden ignoriert und eine leere Nachricht wird abgebrochen
# das Commit.

Ersetzen Sie diesen Text durch einen informativeren:


Änderungen vom Master des Upstream-Repositorys build-system.git abrufen:

Merge Commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65'

Nach dem Speichern dieser Nachricht und dem Schließen des Editors erhalten wir die folgende Ausgabe:


 Merge made by the 'recursive' strategy. build-system/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

Das heißt, wir haben Änderungen am Upstream-Repository remote / build-system.git erhalten und diese im Teilbaum build-system der lokalen Kopie des Hauptrepositorys remote / platform.git gespeichert.


Überprüfen Sie den Status des lokalen Repositorys:


 bash-4.4$ bash-4.4$ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean bash-4.4$ 

Damit andere Benutzer des Projekts diese Änderungen erhalten können, müssen sie im Upstream-Repository remote / platform.git abgelegt werden :


 bash-4.4$ bash-4.4$ git push Enumerating objects: 9, done. Counting objects: 100% (8/8), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 583 bytes | 583.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To ../../remote/platform.git 442c9e9..ea52eab master -> master bash-4.4$ 

Mal sehen, was die lokale Kopie des Plattform- Repositorys jetzt enthält, sowie das Upstream-Repository remote / platform.git :


 bash-4.4$ bash-4.4$ git log --graph * commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (HEAD -> master, origin/master) |\ Merge: 442c9e9 e5c5446 | | Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 | | * | commit 47905bcb80be6f7cb3030513986fad4df548f812 |\ \ Merge: 7fad4be 783c6d5 | |/ Author: user <___@_______> | | Date: Thu Nov 1 20:20:20 2018 +0300 | | | | Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d | | git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: master | | | * commit 783c6d5af1100e9665f930c818c861ff011bed19 | Author: user <___@_______> | Date: Thu Nov 1 20:16:33 2018 +0300 | | init build-system master 1.0.0 | * commit 7fad4becbd13258216fb95cbe9d987dd33f0be6d Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init platform master 1.0.0 bash-4.4$ 


Wir sehen, dass der Anfangszustand des Repositorys remote / build-system.git zum Zeitpunkt der Verbindung als Plattform-Teilbaum 783c6d5af1100e9665f930c818c861ff011bed19 war . Während wir jedoch am Code im Plattform- Repository arbeiteten, änderte sich der Status des Repositorys und wurde gleich e5c5446967599065dc02a269d8fcfc2c1d3c4f65 .

Der Anfangszustand des Build-Systems ( 783c6d5af1100e9665f930c818c861ff011bed19 ) befand sich bereits in der Historie des Plattform- Repositorys, als es sich unter 442c9e94c9890032fb2f3123661345d465e2849f befand . Daher müssen wir den Plattformstatus bei 442c9e94c9890032fb2f3123661345d465e2849f und den Build-Systemstatus bei e5c5446967599065dc02a269d8fcfc2c1d3c4f65 nehmen , die Differenz zwischen ihnen berechnen und den resultierenden Unterschied über den Hauptzweig legen .


Dies ist die Standardoperation zum Zusammenführen von Zweigen, deren Kern durch die Formel ausgedrückt werden kann


  p[n] = p[n-1] + diff(p[n-1], b[n]) 

wo


  p[n] = ea52eabd5910159efabd80adcf522f22bf6a2af2, p[n-1] = 442c9e94c9890032fb2f3123661345d465e2849f, b[n] = e5c5446967599065dc02a269d8fcfc2c1d3c4f65. 

Hier fungiert p als Master-Zweig, und b spielt die Rolle eines Zweigs, der zuvor vom Master getrennt wurde, um neue Funktionen zu erstellen.


Betrachten Sie noch einmal die Nachricht, die das Dienstprogramm git-subtree (1) während der Ausführung des Befehls git-subtree-pull für uns vorbereitet hat:


  git subtree pull --prefix=build-system ../../remote/build-system.git/ master 


Merge Commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65'

# Bitte geben Sie eine Commit-Nachricht ein, um zu erklären, warum diese Zusammenführung erforderlich ist.
# insbesondere, wenn ein aktualisierter Upstream in einem Themenzweig zusammengeführt wird.
#
# Zeilen, die mit '#' beginnen, werden ignoriert und eine leere Nachricht wird abgebrochen
# das Commit.

Diese Nachricht enthält wichtige Informationen für uns, nämlich den Zustand


  b[n] = e5c5446967599065dc02a269d8fcfc2c1d3c4f65 

in dem sich der Hauptzweig des Repositorys remote / build-system.git befand, bevor er in den Hauptzweig des Plattform- Repositorys hochgeladen wurde .


Natürlich ist es nicht sehr praktisch , die Festschreibungsnachricht manuell auszuführen , wenn der Befehl git-subtree-pull ausgeführt wird. Dies ist jedoch eine andere Möglichkeit, uns den Status zu übergeben


  b[n] = e5c5446967599065dc02a269d8fcfc2c1d3c4f65 

Das Dienstprogramm git-subtree (1) existiert in diesem Fall einfach nicht.


Wenn wir die Steuerung -m verwenden


  git subtree pill -m "Our own message" ... 

dann würden wir den Wert des Zustands b [n] verlieren und unser Kommentar wäre nicht informativ und daher völlig nutzlos.


Es ist zu beachten, dass wir nach dem Verschieben des Status des Hauptzweigs des Buildsystem- Repositorys vom ursprünglichen Einhängepunkt 47905bcb80be6f7cb3030513986fad4df548f812 immer eine Benachrichtigung über Änderungen in remote / build-system.git erhalten, während wir die Liste der verbundenen Teilbäume anzeigen. Mit anderen Worten, mit der Option -d in einem Befehl:


  git subtree -d --list 

führt immer zu einer Meldung ähnlich der folgenden:


 bash-4.4$ bash-4.4$ git subtree -d --list Looking for externals... Commit: 47905bcb80be6f7cb3030513986fad4df548f812 build-system ../../remote/build-system.git/ branch master HEAD The 'build-system' subtree seems not updated: original revision: 783c6d5af1100e9665f930c818c861ff011bed19 remote revision: e5c5446967599065dc02a269d8fcfc2c1d3c4f65 You can update 'build-system' subtree by following command: git subtree pull --prefix=build-system ../../remote/build-system.git/ master bash-4.4$ 

Dies geschieht, weil alle Informationen zum verbundenen Teilbaum in der Nachricht enthalten sind, die dem Commit 47905bcb80be6f7cb3030513986fad4df548f812 beigefügt ist :


 bash-4.4$ bash-4.4$ git show 47905bcb80be6f7cb3030513986fad4df548f812 commit 47905bcb80be6f7cb3030513986fad4df548f812 Merge: 7fad4be 783c6d5 Author: user <___@_______> Date: Thu Nov 1 20:20:20 2018 +0300 Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' git-subtree-dir: build-system git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 git-subtree-repo: ../../remote/build-system.git/ git-subtree-ref: master diff --cc build-system/README index 0000000,0000000..73a41c7 new file mode 100644 --- /dev/null +++ b/build-system/README @@@ -1,0 -1,0 +1,3 @@@ ++ ++[master] build-system 1.0.0 ++ bash-4.4$ 

und es gibt kein anderes Repository für diese Informationen.


Das einzige ist, dass jetzt nach jeder Aktualisierung des Hauptzweigs des Repositorys remote / build-system.git auf der Plattformseite bei der Ausführung des Befehls


  git subtree -d --list 

Nur der Wert der Zeichenfolge ändert sich


  remote revision: e5c5446967599065dc02a269d8fcfc2c1d3c4f65 

und wir müssen selbst entscheiden, ob wir neue Änderungen am Teilbaum des Build-Systems benötigen oder im Moment nicht benötigt werden.


Es wird uns jedoch nicht schwer fallen, den Pull- Befehl so oft auszuführen , wie wir ihn benötigen, denn wenn das Repository remote / build-system.git keine tatsächlichen Änderungen hatte, lautet der Befehl:


  git subtree pull --prefix=build-system ../../remote/build-system.git/ master 

wird eine angemessene Nachricht geben:


 bash-4.4$ bash-4.4$ git subtree pull --prefix=build-system ../../remote/build-system.git/ master From ../../remote/build-system * branch master -> FETCH_HEAD Already up to date. bash-4.4$ 


Code von Benutzern abrufen


Jetzt können alle Benutzer des Upstream-Repositorys remote / platform.git einen vollständig konfigurierten Quellbaum mit einem einzigen git-pull (1) -Befehl abrufen:


 bash-4.4$ bash-4.4$ cd user/platform/ bash-4.4$ bash-4.4$ git pull remote: Enumerating objects: 15, done. remote: Counting objects: 100% (15/15), done. remote: Compressing objects: 100% (8/8), done. remote: Total 13 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (13/13), done. From ../../remote/platform 7fad4be..ea52eab master -> origin/master Updating 7fad4be..ea52eab Fast-forward README | 2 +- build-system/README | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 build-system/README bash-4.4$ 

Darüber hinaus können Benutzer den Entwicklungsverlauf nicht nur des Hauptrepositorys des Projekts, sondern auch aller seiner Teilbäume verfolgen:


 bash-4.4$ bash-4.4$ git log -3 --graph * commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (HEAD -> master, origin/master, origin/HEAD) |\ Merge: 442c9e9 e5c5446 | | Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 bash-4.4$ 


Übermitteln von Teilbaumänderungen an das Upstream-Repository


Merken Sie sich den Status der Dateien sowie das Plattform- Repository selbst:


 bash-4.4$ bash-4.4$ git log -3 --graph * commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (HEAD -> master, origin/master, origin/HEAD) |\ Merge: 442c9e9 e5c5446 | | Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 bash-4.4$ 

Wir werden Änderungen am Build-System- Teilbaum vornehmen. Bearbeiten Sie dazu die Datei platform / build-system / README :


 bash-4.4$ bash-4.4$ cd owner/platform/ bash-4.4$ bash-4.4$ vim build-system/README bash-4.4$ cat build-system/README [master] build-system 1.0.2 bash-4.4$ bash-4.4$ git add build-system/README bash-4.4$ git commit -m "build-system is updated to version 1.0.2 from platform side" [master abaa2c5] build-system is updated to version 1.0.2 from platform side 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

Diese Änderungen werden jedoch nicht im Ursprungs- / Master- Plattform- Repository aufgezeichnet. Das heißt, wir werden den Befehl git-push (1) nicht ausführen, sondern git-subtree-push direkt in den Ursprung des Repositorys remote / build-system.git ausführen :


 bash-4.4$ bash-4.4$ git subtree push --prefix=build-system ../../remote/build-system.git/ master git push using: ../../remote/build-system.git/ master Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 290 bytes | 290.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ../../remote/build-system.git/ e5c5446..0673142 0673142942ccf53514a276e855a98514952bb713 -> master bash-4.4$ 

Scrollen Sie durch die Teilbäume und stellen Sie sicher, dass die HEAD-Hauptzweige des ursprünglichen Repositorys remote / build-system.git fortfahren :


 bash-4.4$ bash-4.4$ git subtree -d --list Looking for externals... Commit: 47905bcb80be6f7cb3030513986fad4df548f812 build-system ../../remote/build-system.git/ branch master HEAD The 'build-system' subtree seems not updated: original revision: 783c6d5af1100e9665f930c818c861ff011bed19 remote revision: 0673142942ccf53514a276e855a98514952bb713 You can update 'build-system' subtree by following command: git subtree pull --prefix=build-system ../../remote/build-system.git/ master bash-4.4$ 

Schauen wir uns außerdem den Status der lokalen Kopie des Plattform- Repositorys an und denken Sie daran, dass das letzte Commit von uns im Upstream-Repository noch nicht festgelegt wurde:


 bash-4.4$ bash-4.4$ git log -4 --graph * commit abaa2c5edd49dd0cf395c99877b4711d0170af37 (HEAD -> master) | Author: user <___@_______> | Date: Thu Nov 1 21:48:40 2018 +0300 | | build-system is updated to version 1.0.2 from platform side | * commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (origin/master) |\ Merge: 442c9e9 e5c5446 | | Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 bash-4.4$ 

Der richtige Weg, um Änderungen an das Upstream-Repository des Hauptprojekts zu senden, besteht darin, sicherzustellen, dass alle unsere Teilbaumänderungen nicht direkt an das Hauptrepository gesendet werden, sondern aus dem Upstream-Repository des Teilbaums stammen, als würden wir sie mit dem Befehl git-subtree-pull empfangen. Als Nächstes erklären wir die Bedeutung unserer Aktionen. Um nachfolgende Probleme zu vermeiden, setzen wir das letzte Commit ( abaa2c5edd49dd0cf395c99877b4711d0170af37 ) auf eine lokale Kopie des Plattform- Repositorys zurück:


 bash-4.4$ bash-4.4$ git reset --hard HEAD^ HEAD is now at ea52eab Pull changes from master of upstream build-system.git repository. bash-4.4$ 

um dann das gleiche Commit zurück zu "entfernen", jedoch aus dem ursprünglichen Upstream-Repository von remote / build-system.git . Stellen Sie jedoch zunächst sicher, dass wir das letzte Commit abaa2c5edd49dd0cf395c99877b4711d0170af37 entfernt haben :


 bash-4.4$ bash-4.4$ git log -3 --graph * commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (HEAD -> master, origin/master) |\ Merge: 442c9e9 e5c5446 | | Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 bash-4.4$ 

, ea52eabd5910159efabd80adcf522f22bf6a2af2 , remote/build-system.git . , , git-subtree-pull :


 bash-4.4$ bash-4.4$ git subtree pull --prefix=build-system ../../remote/build-system.git/ master From ../../remote/build-system * branch master -> FETCH_HEAD hint: Waiting for your editor to close the file... 

, :


Merge commit '0673142942ccf53514a276e855a98514952bb713'

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

:


Pull changes from master of origin remote/build-system repository.

Merge commit '0673142942ccf53514a276e855a98514952bb713'

, , :


 Merge made by the 'recursive' strategy. build-system/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

, , remote/build-system.git - . , build-system platform , remote/build-system.git :


 bash-4.4$ bash-4.4$ git log --graph * commit 04a13bac91d1c445994ffc19db8b479d5e644e17 (HEAD -> master) |\ Merge: ea52eab 0673142 | | Author: user <___@_______> | | Date: Thu Nov 1 21:59:45 2018 +0300 | | | | Pull changes from master of origin remote/build-system repository. | | | | Merge commit '0673142942ccf53514a276e855a98514952bb713' | | | * commit 0673142942ccf53514a276e855a98514952bb713 | | Author: user <___@_______> | | Date: Thu Nov 1 21:48:40 2018 +0300 | | | | build-system is updated to version 1.0.2 from platform side | | * | commit ea52eabd5910159efabd80adcf522f22bf6a2af2 (origin/master) |\ \ Merge: 442c9e9 e5c5446 | |/ Author: user <___@_______> | | Date: Thu Nov 1 20:48:05 2018 +0300 | | | | Pull changes from master of upstream build-system.git repository. | | | | Merge commit 'e5c5446967599065dc02a269d8fcfc2c1d3c4f65' | | | * commit e5c5446967599065dc02a269d8fcfc2c1d3c4f65 | | Author: user <___@_______> | | Date: Thu Nov 1 20:26:52 2018 +0300 | | | | update build-system version to 1.0.1 | | * | commit 442c9e94c9890032fb2f3123661345d465e2849f | | Author: user <___@_______> | | Date: Thu Nov 1 20:41:40 2018 +0300 | | | | update platform version to 1.0.1 | | * | commit 47905bcb80be6f7cb3030513986fad4df548f812 |\ \ Merge: 7fad4be 783c6d5 | |/ Author: user <___@_______> | | Date: Thu Nov 1 20:20:20 2018 +0300 | | | | Add 'build-system/' from commit '783c6d5af1100e9665f930c818c861ff011bed19' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7fad4becbd13258216fb95cbe9d987dd33f0be6d | | git-subtree-split: 783c6d5af1100e9665f930c818c861ff011bed19 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: master | | | * commit 783c6d5af1100e9665f930c818c861ff011bed19 | Author: user <___@_______> | Date: Thu Nov 1 20:16:33 2018 +0300 | | init build-system master 1.0.0 | * commit 7fad4becbd13258216fb95cbe9d987dd33f0be6d Author: user <___@_______> Date: Thu Nov 1 20:16:33 2018 +0300 init platform master 1.0.0 bash-4.4$ 

, , upstream- remote/platform.git .


 bash-4.4$ bash-4.4$ git status On branch master Your branch is ahead of 'origin/master' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean bash-4.4$ bash-4.4$ git push Enumerating objects: 9, done. Counting objects: 100% (8/8), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 600 bytes | 600.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To ../../remote/platform.git ea52eab..04a13ba master -> master bash-4.4$ 

, git-subtree-pull , . , git-push(1) , , , .


, upstream- remote/platform.git 04a13bac91d1c445994ffc19db8b479d5e644e17 , remote/build-system.git , , git-subtree-pull , upstream- remote/platform.git , upstream- remote/platform.git (owner/platform).



git-format-patch


, , git-subtre ,
:


  git log -- . ":(exclude)build-system" git log -- build-system 

, , .


git-format-patch .


, , patch- ea52eabd5910159efabd80adcf522f22bf6a2af2 , git-format-patch :


 bash-4.4$ bash-4.4$ git format-patch ea52eabd5910159efabd80adcf522f22bf6a2af2 --stdout From 0673142942ccf53514a276e855a98514952bb713 Mon Sep 17 00:00:00 2001 From: user <___@_______> Date: Thu, 1 Nov 2018 21:48:40 +0300 Subject: [PATCH] build-system is updated to version 1.0.2 from platform side --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 629b3f4..4fbbbaf 100644 --- a/README +++ b/README @@ -1,3 +1,3 @@ -[master] build-system 1.0.1 +[master] build-system 1.0.2 -- 2.19.1 bash-4.4$ 

, build-system/README build-system/, :


 --- a/README +++ b/README 

,
git-diff :


 bash-4.4$ bash-4.4$ git diff ea52eabd5910159efabd80adcf522f22bf6a2af2 04a13bac91d1c445994ffc19db8b479d5e644e17 diff --git a/build-system/README b/build-system/README index 629b3f4..4fbbbaf 100644 --- a/build-system/README +++ b/build-system/README @@ -1,3 +1,3 @@ -[master] build-system 1.0.1 +[master] build-system 1.0.2 bash-4.4$ 

patch-:


 --- a/build-system/README +++ b/build-system/README 

git-diff(1) , , , platform .



Politiker


CM- , . , , :


  • upstream- ;
  • upstream-, .

, .


, , upstream- remote/build-system.git :


 bash-4.4$ bash-4.4$ cd owner/build-system/ bash-4.4$ cat README [master] build-system 1.0.2 bash-4.4$ 

, upstream- remote/build-system.git , , , minor 1.0.2 . build-system-1.1.x , , : 1.1.0 , 1.1.1 , 1.1.2 , .


:


 bash-4.4$ bash-4.4$ git checkout -b build-system-1.1.x Switched to a new branch 'build-system-1.1.x' bash-4.4$ git branch * build-system-1.1.x master bash-4.4$ 

, README 1.1.0 :


 bash-4.4$ bash-4.4$ vim README bash-4.4$ cat README [master] build-system 1.1.0 bash-4.4$ bash-4.4$ git commit -a -m "Move on to developing 1.1.x functionality" [build-system-1.1.x f6d79c1] Move on to developing 1.1.x functionality 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

upstream- remote/build-system.git :


 bash-4.4$ bash-4.4$ git push --set-upstream origin build-system-1.1.x Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 280 bytes | 280.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ../../remote/build-system.git * [new branch] build-system-1.1.x -> build-system-1.1.x Branch 'build-system-1.1.x' set up to track remote branch 'build-system-1.1.x' from 'origin'. bash-4.4$ 

, , , 1.1.1 :


 bash-4.4$ bash-4.4$ vim README bash-4.4$ cat README [master] build-system 1.1.1 bash-4.4$ bash-4.4$ git commit -a -m "Update build-system version to 1.1.1" [build-system-1.1.x f9544a4] Update build-system version to 1.1.1 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ bash-4.4$ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 276 bytes | 276.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To ../../remote/build-system.git f6d79c1..f9544a4 build-system-1.1.x -> build-system-1.1.x bash-4.4$ 

:


 bash-4.4$ bash-4.4$ git tag -a 1.1.1 -m "Created tag for release (version 1.1.1)" bash-4.4$ git push origin 1.1.1 Enumerating objects: 1, done. Counting objects: 100% (1/1), done. Writing objects: 100% (1/1), 170 bytes | 170.00 KiB/s, done. Total 1 (delta 0), reused 0 (delta 0) To ../../remote/build-system.git * [new tag] 1.1.1 -> 1.1.1 bash-4.4$ 

upstream- remote/build-system.git :


 bash-4.4$ bash-4.4$ cd remote/build-system.git/ bash-4.4$ tree refs refs ├── heads │  ├── build-system-1.1.x │  └── master └── tags └── 1.1.1 2 directories, 3 files bash-4.4$ 

, platform build-system . , , , , platform-1.0.2 :


 bash-4.4$ bash-4.4$ cd user/platform/ bash-4.4$ git branch * master bash-4.4$ git pull Already up to date. bash-4.4$ bash-4.4$ git checkout -b platform-1.0.2 Switched to a new branch 'platform-1.0.2' bash-4.4$ vim README bash-4.4$ cat README [master] platform 1.0.2 bash-4.4$ git commit -a -m "reated platform-1.0.2 branch for the transition to the system 1.1.1" [platform-1.0.2 00a1250] reated platform-1.0.2 branch for the transition to the system 1.1.1 1 file changed, 1 insertion(+), 1 deletion(-) bash-4.4$ 

, , - remote/build-system.git , 1.1.1 :


 bash-4.4$ bash-4.4$ git rm -rf build-system/ rm 'build-system/README' bash-4.4$ git commit -a -m "Removed subtre based on build-system/master" [platform-1.0.2 7db0f54] Removed subtre based on build-system/master 1 file changed, 3 deletions(-) delete mode 100644 build-system/README bash-4.4$ bash-4.4$ bash-4.4$ git push --set-upstream origin platform-1.0.2 Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 550 bytes | 550.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) To ../../remote/platform.git/ * [new branch] platform-1.0.2 -> platform-1.0.2 Branch 'platform-1.0.2' set up to track remote branch 'platform-1.0.2' from 'origin'. bash-4.4$ bash-4.4$ bash-4.4$ git subtree add --prefix=build-system ../../remote/build-system.git/ 1.1.1 git fetch ../../remote/build-system.git/ 1.1.1 remote: Enumerating objects: 9, done. remote: Counting objects: 100% (9/9), done. remote: Compressing objects: 100% (3/3), done. remote: Total 7 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (7/7), done. From ../../remote/build-system * tag 1.1.1 -> FETCH_HEAD Added dir 'build-system' bash-4.4$ 

build-system upstream- remote/platform.git :


 bash-4.4$ bash-4.4$ git push Enumerating objects: 12, done. Counting objects: 100% (12/12), done. Delta compression using up to 4 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (8/8), 889 bytes | 889.00 KiB/s, done. Total 8 (delta 0), reused 0 (delta 0) To ../../remote/platform.git/ 7db0f54..6f1a50e platform-1.0.2 -> platform-1.0.2 bash-4.4$ 

:


 bash-4.4$ bash-4.4$ git log -3 --graph * commit 6f1a50e249e01f69c54f343b65747d28abc6456d (HEAD -> platform-1.0.2, origin/platform-1.0.2) |\ Merge: 7db0f54 f9544a4 | | Author: user <___@_______> | | Date: Fri Nov 2 18:24:54 2018 +0300 | | | | Add 'build-system/' from commit 'f045926542e9f685034545a45317093383fddf99' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7db0f5452e67086dc4e381a0ccb14f25d48ecf0b | | git-subtree-split: f045926542e9f685034545a45317093383fddf99 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: 1.1.1 | | | * commit f9544a4cc2650a83b96f400fdfc95ba64a38ec6e | | Author: user <___@_______> | | Date: Fri Nov 2 17:59:43 2018 +0300 | | | | Update build-system version to 1.1.1 | | | * commit f6d79c12ada29438454739fe6f6db9592d413be2 | | Author: user <___@_______> | | Date: Fri Nov 2 17:54:35 2018 +0300 | | | | Move on to developing 1.1.x functionality bash-4.4$ 

, CM- , platform , platform-1.0.2 build-system . , , build-system , .


, upstream- build-system platform , pre-receive


  remote/build-system.git/hooks/pre-receive 

, , :


 #!/bin/sh zero_commit="0000000000000000000000000000000000000000" LC_COLLATE='C' allowed_users=(habr habrahabr) while read oldrev newrev refname; do # # git-subtree(1) push       , #    .      # : # # 1)       ,   ,  # 2)         tag,    #       ,  , , #  'refs/tags/1.1.1',  '1.1.1',  git-subtree(1) #       'refs/heads/1.1.1', #     . # : if [[ $oldrev == $zero_commit && $refname =~ ^refs/heads/ ]]; then refbase=$(basename $refname) refpath=$(git show-ref $refbase | cut -f2 -d' ') if [[ $refpath =~ ^refs/tags/.*$ ]]; then echo "" echo "ERROR: Trying to change TAG named as '$refpath'." echo "" exit 1 fi if [[ ! ${allowed_users[*]} =~ $USER ]]; then echo "" echo "ERROR: Trying to create NEW BRANCH with name '$refname'." echo "" exit 1 fi fi done exit 0 

. , , , , , , . , , :


  git subtree push --prefix=<subdir> <remote> <ref> 

<ref> , <subdir> , , (refs/tags/1.1.1), (1.1.1) upstream- ( : refs/heads/1.1.1).


, git-subtree(1) . .


, pre-receive , user/platform/build-system/README:


 bash-4.4$ bash-4.4$ cd user/platform/ bash-4.4$ vim build-system/README bash-4.4$ cat build-system/README [master] build-system 1.1.1 Try to change. bash-4.4$ bash-4.4$ git commit -a -m "Try to change the tag of build-system" [platform-1.0.2 34e7970] Try to change the tag of build-system 1 file changed, 2 insertions(+) bash-4.4$ 

upstream- remote/build-system.git .


...

upstream-


  git subtree push --prefix=<subdir> <remote> <ref> 

, , , :


 bash-4.4$ git subtree -d --list Looking for externals... Commit: 6f1a50e249e01f69c54f343b65747d28abc6456d build-system ../../remote/build-system.git/ tag 1.1.1 f045926542e9f685034545a45317093383fddf99 bash-4.4$ 

, , upstream- remote/build-system.git :




 bash-4.4$ bash-4.4$ git subtree push --prefix=build-system ../../remote/build-system.git/ 1.1.1 git push using: ../../remote/build-system.git/ 1.1.1 Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Writing objects: 100% (3/3), 293 bytes | 293.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: remote: ERROR: Trying to change TAG named as 'refs/tags/1.1.1'. remote: To ../../remote/build-system.git/ ! [remote rejected] c3a7333aaa818a7d7a0d501d4b69db1c6a01d40f -> 1.1.1 (pre-receive hook declined) error: failed to push some refs to '../../remote/build-system.git/' bash-4.4$ 

, , pre-receive , . :


 remote: remote: ERROR: Trying to change TAG named as 'refs/tags/1.1.1'. remote: 

, , , , :


 bash-4.4$ bash-4.4$ git reset --hard HEAD^ HEAD is now at 6f1a50e Add 'build-system/' from commit 'f045926542e9f685034545a45317093383fddf99' bash-4.4$ 

, , platform-1.0.2 :


 bash-4.4$ bash-4.4$ git log -3 --graph * commit 6f1a50e249e01f69c54f343b65747d28abc6456d (HEAD -> platform-1.0.2, origin/platform-1.0.2) |\ Merge: 7db0f54 f9544a4 | | Author: user <___@_______> | | Date: Fri Nov 2 18:24:54 2018 +0300 | | | | Add 'build-system/' from commit 'f045926542e9f685034545a45317093383fddf99' | | | | git-subtree-dir: build-system | | git-subtree-mainline: 7db0f5452e67086dc4e381a0ccb14f25d48ecf0b | | git-subtree-split: f045926542e9f685034545a45317093383fddf99 | | git-subtree-repo: ../../remote/build-system.git/ | | git-subtree-ref: 1.1.1 | | | * commit f9544a4cc2650a83b96f400fdfc95ba64a38ec6e | | Author: user <___@_______> | | Date: Fri Nov 2 17:59:43 2018 +0300 | | | | Update build-system version to 1.1.1 | | | * commit f6d79c12ada29438454739fe6f6db9592d413be2 | | Author: user <___@_______> | | Date: Fri Nov 2 17:54:35 2018 +0300 | | | | Move on to developing 1.1.x functionality bash-4.4$ 



git-subrepo , , squashed-, git-subtree(1) , .


, . git-subrepo . , git-subtree , , Git , , , Git .



:


Source: https://habr.com/ru/post/de429014/


All Articles