You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The blob is now a different blob, which means that although you added only a single line to the end of a 400-line file, Git stored that new content as a completely new object:
76
+
Το blob είναι τώρα ένα διαφορετικό blob, πράγμα που σημαίνει ότι αν και προσθέσατε μόνο μία γραμμή στο τέλος ενός αρχείου 400 γραμμών, το Git αποθηκεύει αυτό το νέο περιεχόμενο ως ένα εντελώς νέο αντικείμενο:
You have two nearly identical 22K objects on your disk.
85
-
Wouldn't it be nice if Git could store one of them in full but then the second object only as the delta between it and the first?
84
+
Έχουμε δύο σχεδόν ταυτόσημα αντικείμενα 22K στο δίσκο μας.
85
+
Δεν θα ήταν ωραίο αν το Git μπορούσε να αποθηκεύσει ένα από αυτά πλήρως, αλλά το δεύτερο αντικείμενο μόνο ως το δέλτα μεταξύ αυτού και του πρώτου;
86
86
87
-
It turns out that it can.
88
-
The initial format in which Git saves objects on disk is called a ``loose'' object format.
89
-
However, occasionally Git packs up several of these objects into a single binary file called a ``packfile'' in order to save space and be more efficient.
90
-
Git does this if you have too many loose objects around, if you run the `git gc`command manually, or if you push to a remote server.
91
-
To see what happens, you can manually ask Git to pack up the objects by calling the `git gc` command:
87
+
Ε, λοιπόν, μπορεί.
88
+
Η αρχική μορφή στην οποία το Git αποθηκεύει αντικείμενα στον δίσκο ονομάζεται _χαλαρή_ μορφή αντικειμένου.
89
+
Εντούτοις, περιστασιακά το Git ``πακετάρει'' αρκετά από αυτά τα αντικείμενα σε ένα μόνο δυαδικό αρχείο που ονομάζεται πακέτο (packfile) για να εξοικονομήσει χώρο και να είναι πιο αποδοτικό.
90
+
Το Git το κάνει αυτό εάν έχουμε πολλά χαλαρά αντικείμενα γύρω μας, αν εκτελέσουμε χειροκίνητα την εντολή `git gc`ή αν ωθήσουμε σε έναν απομακρυσμένο διακομιστή.
91
+
Για να δούμε τι συμβαίνει, μπορούμε να ζητήσουμε από το Git να συσκευάσει τα αντικείμενα καλώντας την εντολή `git gc`:
If you look in your objects directory, you'll find that most of your objects are gone, and a new pair of files has appeared:
103
+
Αν κοιτάξουμε στον κατάλογο των αντικειμένων μας, θα διαπιστώσουμε ότι τα περισσότερα αντικείμενά μας έχουν εξαφανιστεί και εμφανίστηκε ένα νέο ζευγάρι αρχείων:
The objects that remain are the blobs that aren't pointed to by any commit – in this case, the``what is up, doc?'' example and the ``test content'' example blobs you created earlier.
116
-
Because you never added them to any commits, they're considered dangling and aren't packed up in your new packfile.
115
+
Τα αντικείμενα που παραμένουν είναι τα blob στα οποία δεν δείχνει καμία υποβολή --στην περίπτωση αυτή, τα``what up, doc'' και ``test content'' που δημιουργήσαμε νωρίτερα.
116
+
Επειδή δεν τα προσθέσαμε ποτέ σε καμία υποβολή, θεωρούνται ότι εκκρεμή και δεν έχουν συσκευαστεί στο νέο μας πακέτο.
117
117
118
-
The other files are your new packfile and an index.
119
-
The packfile is a single file containing the contents of all the objects that were removed from your filesystem.
120
-
The index is a file that contains offsets into that packfile so you can quickly seek to a specific object.
121
-
What is cool is that although the objects on disk before you ran the `gc` were collectively about 22K in size, the new packfile is only 7K.
122
-
You've cut your disk usage by ⅔ by packing your objects.
118
+
Τα άλλα αρχεία είναι το νέο πακέτο και ένα ευρετήριο.
119
+
Το πακέτο είναι μόνον ένα αρχείο που περιέχει τα περιεχόμενα όλων των αντικειμένων που έχουν αφαιρεθεί από το σύστημα αρχείων μας.
120
+
Το ευρετήριο είναι ένα αρχείο που περιέχει τις θέσεις σε byte των αντικειμένων σε αυτό το packfile ώστε η αναζήτηση ενός συγκεκριμένου αντικειμένου να γίνεται γρήγορα.
123
121
124
-
How does Git do this?
125
-
When Git packs objects, it looks for files that are named and sized similarly, and stores just the deltas from one version of the file to the next.
126
-
You can look into the packfile and see what Git did to save space.
127
-
The `git verify-pack` plumbing command allows you to see what was packed up:
122
+
Το ωραίο είναι ότι αν και τα αντικείμενα στον δίσκο προτού εκτελέσουμε την `gc` ήταν συνολικά περίπου 22Κ σε μέγεθος, το νέο πάκο είναι μόνο 7K.
123
+
Έχουμε μειώσει τη χρήση του δίσκου κατά ⅔ επειδή πακετάραμε τα αντικείμενά μας.
124
+
125
+
Πώς το κάνει αυτό το Git;
126
+
Όταν το Git πακετάρει αντικείμενα, ψάχνει για αρχεία που έχουν παρόμοιο όνομα και μέγεθος και αποθηκεύει μόνο τις διαφορές (deltas) από μια έκδοση του αρχείου στην επόμενη.
127
+
Μπορούμε να δούμε μέσα στο πακέτο και να δούμε τι έκανε το Git για να εξοικονομήσει χώρο.
128
+
Η εντολή `git verify-pack` μας δίνει τη δυνατότητα να δούμε τι ήταν συσκευάστηκε στο πακέτο:
128
129
129
130
[source,console]
130
131
----
@@ -155,9 +156,10 @@ chain length = 1: 3 objects
155
156
.git/objects/pack/pack-978e03944f5c581011e6998cd0e9e30000905586.pack: ok
156
157
----
157
158
158
-
Here, the `033b4` blob, which if you remember was the first version of your repo.rb file, is referencing the `b042a` blob, which was the second version of the file.
159
-
The third column in the output is the size of the object in the pack, so you can see that `b042a` takes up 22K of the file, but that `033b4` only takes up 9 bytes.
160
-
What is also interesting is that the second version of the file is the one that is stored intact, whereas the original version is stored as a delta – this is because you're most likely to need faster access to the most recent version of the file.
159
+
Εδώ, το blob `033b4`, το οποίο, ας θυμηθούμε, ήταν η πρώτη έκδοση του αρχείου repo.rb γίνεται αναφορά στο blob `b042a`, που ήταν η δεύτερη έκδοση του αρχείου.
160
+
Η τρίτη στήλη στην έξοδο είναι το μέγεθος του αντικειμένου στο πακέτο, ώστε να μπορούμε να δούμε ότι το `b042a` καταλαμβάνει 22Κ του αρχείου, αλλά το `033b4` καταλαμβάνει μόνο 9 byte.
161
+
Αυτό που είναι επίσης ενδιαφέρον είναι ότι η δεύτερη έκδοση του αρχείου είναι αυτή που είναι αποθηκευμένη άθικτη, ενώ η αρχική έκδοση αποθηκεύεται ως δέλτα --αυτό γίνεται επειδή πιθανότατα θα χρειαστούμε ταχύτερη πρόσβαση στην πιο πρόσφατη έκδοση του αρχείου .
162
+
163
+
Αυτό που είναι πραγματικά ωραίο είναι ότι μπορεί να ανασυσκευαστεί ανά πάσα στιγμή.
164
+
Το Git ξαναπακετάρει κατά καιρούς τη βάση δεδομένων μας αυτόματα, προσπαθώντας πάντα να εξοικονομήσει περισσότερο χώρο, αλλά μπορούμε επίσης να επανασυσκευάσουμε μη-αυτόματα οποιαδήποτε στιγμή τρέχοντας `git gc`.
161
165
162
-
The really nice thing about this is that it can be repacked at any time.
163
-
Git will occasionally repack your database automatically, always trying to save more space, but you can also manually repack at any time by running `git gc` by hand.
0 commit comments