Skip to content

Commit 4ee890c

Browse files
committed
Translated subtree-merges.
1 parent 6075d71 commit 4ee890c

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

book/07-git-tools/sections/subtree-merges.asc

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
[[_subtree_merge]]
2-
===== Subtree Merging
2+
===== Συγχώνευση υποδένδρων
33

4-
The idea of the subtree merge is that you have two projects, and one of the projects maps to a subdirectory of the other one and vice versa.
5-
When you specify a subtree merge, Git is often smart enough to figure out that one is a subtree of the other and merge appropriately.
4+
Η ιδέα της συγχώνευσης υποκαταστημάτων είναι ότι έχουμε δύο έργα και ένα από τα έργα απεικονίζεται σε έναν υποκατάλογο του άλλου και τούμπαλιν.
5+
Όταν καθορίζουμε μια συγχώνευση υποδένδρων, το Git είναι συχνά αρκετά έξυπνο για να καταλάβει ότι το ένα είναι ένα υποδένδρο του άλλου και τα συγχωνεύει κατάλληλα.
66

7-
We'll go through an example of adding a separate project into an existing project and then merging the code of the second into a subdirectory of the first.
7+
Θα δούμε ένα παράδειγμα προσθήκης ενός ξεχωριστού έργου σε ένα υπάρχον και στη συνέχεια τη συγχώνευση του κώδικα του δεύτερου σε έναν υποκατάλογο του πρώτου.
88

9-
First, we'll add the Rack application to our project.
10-
We'll add the Rack project as a remote reference in our own project and then check it out into its own branch:
9+
XXX Αρχικά, θα προσθέσουμε την εφαρμογή Rack στο έργο μας· Θα προσθέσουμε το έργο Rack ως απομακρυσμένη αναφορά στο δικό μας έργο και στη συνέχεια θα το checkout XXX στον δικό του κλάδο:
1110

1211
[source,console]
1312
----
@@ -29,8 +28,7 @@ Branch rack_branch set up to track remote branch refs/remotes/rack_remote/master
2928
Switched to a new branch "rack_branch"
3029
----
3130

32-
Now we have the root of the Rack project in our `rack_branch` branch and our own project in the `master` branch.
33-
If you check out one and then the other, you can see that they have different project roots:
31+
Τώρα έχουμε τη ρίζα του έργου Rack στον κλάδο `rack_branch` και το δικό μας έργο στον κλάδο `master`. Εάν τα κάνουμε checkout θα δούμε ότι το κάθε έργο έχει διαφορετική ρίζα:
3432

3533
[source,console]
3634
----
@@ -43,33 +41,31 @@ $ ls
4341
README
4442
----
4543

46-
This is sort of a strange concept.
47-
Not all the branches in your repository actually have to be branches of the same project.
48-
It's not common, because it's rarely helpful, but it's fairly easy to have branches contain completely different histories.
44+
Αυτή είναι μια κάπως παράξενη σύλληψη.
45+
Δεν είναι απαραίτητο όλοι οι κλάδοι του αποθετηρίου μας να είναι υποχρεωτικά κλάδοι του ίδιου έργου.
46+
Δεν είναι συνηθισμένο, διότι είναι σπάνια χρήσιμο, αλλά είναι αρκετά εύκολο να έχουμε κλάδους που περιέχουν εντελώς διαφορετικές ιστορικά.
4947

50-
In this case, we want to pull the Rack project into our `master` project as a subdirectory.
51-
We can do that in Git with `git read-tree`.
52-
You’ll learn more about `read-tree` and its friends in <<_git_internals>>, but for now know that it reads the root tree of one branch into your current staging area and working directory.
53-
We just switched back to your `master` branch, and we pull the `rack_branch` branch into the `rack` subdirectory of our `master` branch of our main project:
48+
Σε αυτήν την περίπτωση, θέλουμε να έλξουμε το έργο Rack στο έργο του κλάδου `master` ως υποκατάλογο.
49+
Αυτό μπορούμε να το κάνουμε στο Git με την εντολή `git read-tree`. Θα μάθουμε περισσότερα σχετικά με την `read-tree` και τους φίλους της στην ενότητα <<_git_internals>>, αλλά προς το παρόν αρκεί να γνωρίζουμε ότι διαβάζει το ριζικό δέντρο ενός κλάδου στον τρέχον ενδιάμεσο στάδιο και τον κατάλογο εργασίας.
50+
Επιστρέφουμε τώρα στον κύριο κλάδο μας και έλκουμε τον κλάδο `rack_branch` στον υποκατάλογο `rack` του κύριου κλάδου `master` του κύριου έργου μας:
5451

5552
[source,console]
5653
----
5754
$ git read-tree --prefix=rack/ -u rack_branch
5855
----
5956

60-
When we commit, it looks like we have all the Rack files under that subdirectory – as though we copied them in from a tarball.
61-
What gets interesting is that we can fairly easily merge changes from one of the branches to the other.
62-
So, if the Rack project updates, we can pull in upstream changes by switching to that branch and pulling:
57+
Όταν υποβάλουμε, φαίνεται ότι έχουμε όλα τα αρχεία του Rack κάτω από αυτόν τον υποκατάλογο --σαν να τα αντιγράψαμε από ένα tarball.
58+
Αυτό που είναι πραγματικά ενδιαφέρον είναι ότι μπορούμε να συγχωνεύσουμε αρκετά εύκολα τις αλλαγές από τον ένα κλάδο στον άλλο.
59+
Επομένως, εάν το έργο Rack ενημερωθεί, μπορούμε να τραβήξουμε τις αλλαγές upstream μεταβαίνοντας σε εκείνο τον κλάδο και έλκοντας:
6360

6461
[source,console]
6562
----
6663
$ git checkout rack_branch
6764
$ git pull
6865
----
6966

70-
Then, we can merge those changes back into our `master` branch.
71-
To pull in the changes and prepopulate the commit message, use the `--squash` option, as well as the recursive merge strategy's `-Xsubtree` option.
72-
(The recursive strategy is the default here, but we include it for clarity.)
67+
Στη συνέχεια, μπορούμε να συγχωνεύσουμε αυτές τις αλλαγές πίσω στον κλάδο `master`. Για να έλξουμε τις αλλαγές και να προεπικαλύψουμε το μήνυμα commit, χρησιμοποιούμε την επιλογή `--squash`, καθώς και την επιλογή `-Xsubtree` της στρατηγικής αναδρομικής συγχώνευσης.
68+
(Η αναδρομική στρατηγική είναι η προεπιλογή εδώ, αλλά την συμπεριλαμβάνουμε για λόγους σαφήνειας.)
7369

7470
[source,console]
7571
----
@@ -79,23 +75,22 @@ Squash commit -- not updating HEAD
7975
Automatic merge went well; stopped before committing as requested
8076
----
8177

82-
All the changes from the Rack project are merged in and ready to be committed locally.
83-
You can also do the opposite – make changes in the `rack` subdirectory of your master branch and then merge them into your `rack_branch` branch later to submit them to the maintainers or push them upstream.
78+
Όλες οι αλλαγές από το έργο Rack έχουν συγχωνευτεί και είναι έτοιμες να υποβληθούν τοπικά.
79+
Μπορούμε επίσης να κάνουμε το αντίθετο --να κάνουμε αλλαγές στον υποκατάλογο rack του κύριου κλάδου μας και στη συνέχεια να τις συγχωνεύσουμε στον κλάδο `rack_branch` αργότερα για να τις υποβάλουμε στους διαχειριστές ή να τις ωθήσουμε προς τα πάνω.
8480

85-
This gives us a way to have a workflow somewhat similar to the submodule workflow without using submodules (which we will cover in <<_git_submodules>>).
86-
We can keep branches with other related projects in our repository and subtree merge them into our project occasionally.
87-
It is nice in some ways, for example all the code is committed to a single place.
88-
However, it has other drawbacks in that it's a bit more complex and easier to make mistakes in reintegrating changes or accidentally pushing a branch into an unrelated repository.
81+
Αυτό μας δίνει έναν τρόπο να έχουμε μια ροή εργασίας κάπως παρόμοια με τη ροή εργασίας των ΧΧΧ submodules / υπομοντέλων χωρίς να χρησιμοποιούμε XXXυπομονάδες (που θα καλύψουμε στην ενότητα [_git_submodules]).
82+
Μπορούμε να διατηρούμε κλάδους με άλλα σχετικά έργα στο αποθετήριο μας και να τα συγχωνεύουμε στο έργο μας περιστασιακά.
83+
Είναι ωραίο από κάποια σκοπιά, για παράδειγμα όλος ο κώδικας υποβάλλεται σε ένα μόνο μέρος.
84+
Ωστόσο, έχει άλλα μειονεκτήματα επειδή είναι λίγο πιο περίπλοκο και είναι πιο εύκολο να κάνουμε κάποιο λάθος στην επανένταξη των αλλαγών ή να ωθήσουμε κατά λάθος έναν κλάδο σε ένα άσχετο αποθετήριο.
8985

90-
Another slightly weird thing is that to get a diff between what you have in your `rack` subdirectory and the code in your `rack_branch` branch – to see if you need to merge them – you can’t use the normal `diff` command.
91-
Instead, you must run `git diff-tree` with the branch you want to compare to:
86+
Κάτι ακόμα ελαφρώς περίεργο είναι ότι για να πάρουμε μια diff ανάμεσα σε αυτό που έχουμε στον υποκατάλογο μας `rack` και τον κώδικα στον κλάδο `rack_branch` --για να δούμε αν πρέπει να τα συγχωνεύσουμε-- δεν μπορούμε να χρησιμοποιήσουμε την κανονική εντολή diff. Αντ 'αυτού, πρέπει να τρέξουμε την `git diff-tree` με τον κλάδο με τον οποίο θέλουμε να συγκρίνουμε:
9287

9388
[source,console]
9489
----
9590
$ git diff-tree -p rack_branch
9691
----
9792

98-
Or, to compare what is in your `rack` subdirectory with what the `master` branch on the server was the last time you fetched, you can run
93+
Ή για να συγκρίνουμε τι είναι στον υποκατάλογο μας `rack` με αυτά που υπήρχαν στον κλάδο `master` του διακομιστή την τελευταία φορά που ανακτήσαμα, μπορούμε να εκτελέσουμε
9994

10095
[source,console]
10196
----

0 commit comments

Comments
 (0)