Git Internals - How Git Works - Fear Not The SHA!

  Рет қаралды 119,486

GitLab

GitLab

Күн бұрын

Пікірлер: 123
@glebkoshelev
@glebkoshelev 5 жыл бұрын
aside from "AHA! moments" there are "hell yeah!" moments when you manage to find a clear and short educational material that covers core conceptual model, so that you wouldn't have to read docs to figure out the gist of it! I love docs, but life is too short to read them all) Thanks a lot! You've saved two days of my life! Multiply that by the number of views ~13k and you've got almost one human life saved!) Great job!
@lynndemarest1902
@lynndemarest1902 6 жыл бұрын
What did that poor keyboard ever do to you? :)
@artembordiuh2802
@artembordiuh2802 4 жыл бұрын
Wonderful tutorial! But the Whac-A-Mole game with the keyboard is very loud.
@AkshayAradhya
@AkshayAradhya 2 жыл бұрын
Man we need more of these intermediate in-depth tutorials. So well made. Every other video tutorial just talks about basic git stuff branches, commits, etc.
@usoppgod8107
@usoppgod8107 3 жыл бұрын
I cannot stress enough how wonderfully things were explained. Cheers man!
@LeeZhenYong
@LeeZhenYong 3 жыл бұрын
This is so well explained! I got a deeper appreciation of how cleverly designed git is. I never knew each time I do git commit it tracks every single file; imagine a project with hundreds of files!
@cyantarek5457
@cyantarek5457 Ай бұрын
This is the best ever low level internals explanation on how git works (like Ben Eater). A gift for us low level fans
@andyd568
@andyd568 11 ай бұрын
Beyond helpful because of its level of detail and precision.
@shyamgadepalli9786
@shyamgadepalli9786 5 жыл бұрын
Great video! Explains in detail how Git works under the hood. The last two examples were an icing on the cake. Thanks for putting this together!
@vil9386
@vil9386 3 жыл бұрын
wow, so glad I watched this. This 30min gave me so much insights of git design (hands-on way!!) and it made git usage instantaneously easier. THANK YOU!
@ansadahmad1958
@ansadahmad1958 6 ай бұрын
Thank you sir for this video! Your efforts into making a simplified free video is much appreciated by us all curious learners!!
@melisoner8981
@melisoner8981 4 жыл бұрын
I wasn't afraid of the shas before but this took it to a different level. Thank you.
@Igor160193
@Igor160193 2 жыл бұрын
I never feared the SHA, but now I understand the SHA. Thank you
@bulletbeatboxer
@bulletbeatboxer 2 жыл бұрын
I send all my new devs this video! SO key in understanding how to use git.
@prasadkailkeresridhar8316
@prasadkailkeresridhar8316 4 жыл бұрын
Brilliant demo of the internals of git! thanks for the information...helps with a good foundation knowledge to understand git commands..thank you David for helping understand.
@KiLVaiDeN
@KiLVaiDeN 2 жыл бұрын
Very interesting tutorial on how the .git folder is impacted by some basic git commands internally, for me it's as important for a git user than knowing how a cpu works for a developer :) Thank you David for this introduction, it will for sure allow me to understand and research about even deeper plumbing of git in the future :)
@komalvenkatesh4527
@komalvenkatesh4527 5 жыл бұрын
Great video. Exactly what I was looking for! Thank you. Every so called "weird/scratch your head" moment in git makes sense now.
@MrHav1k
@MrHav1k 4 жыл бұрын
I'm not even a developer, just an infrastructure guy, but this was an excellent explanation.
@TeenyPort
@TeenyPort 4 жыл бұрын
awesome video so far, but I believe around minute 19:20 when you say "this commit points to 2 files" you are actually talking about the new tree pointing to foo.txt and bar.txt
@nneddenn6207
@nneddenn6207 Жыл бұрын
Nice and crisp explanation! It was good
@JiaweiCao
@JiaweiCao 4 жыл бұрын
Thank you! You explained what happens in git internally in a very easy and clear way!
@emadpres
@emadpres 4 жыл бұрын
Fantastic tutorial! Now it's clear to me when we say Git doesn't store diffs.
@majorgnu
@majorgnu 4 жыл бұрын
It kinda does in pack files, but only as a space-saving optimization, not as a part of its core model.
@RohitSoni1
@RohitSoni1 Жыл бұрын
Goes deep on just one thing ..what's behind the 40 char SHA and makes it easy!! Thanks much!! 😊
@lorenzoluisalbano3695
@lorenzoluisalbano3695 Жыл бұрын
Beautiful. Looking at the hashes and the contents of each file referring to (or named after those) hashes you begin to gain understanding... of just what the eff they have got inside, what they are supposed to be, and what they are connected to. So explicit that pleases and hurts. Kudos for teaching us the most important git command (and how to refer to each of them by the first 6 digits of the hash.): $ git cat-file -t dc23ab / git cat-file -p dc23ab
@tigranrostomyan9231
@tigranrostomyan9231 5 ай бұрын
This is CRAZY. Thank you so much!
@architgupta4087
@architgupta4087 5 жыл бұрын
Amazing. Cleared a lot of things for me.
@parthbhimani9778
@parthbhimani9778 4 жыл бұрын
Thank you for this. Clearly understood the basic internal workings of git.
@ekbastu
@ekbastu 3 жыл бұрын
Hey Thomas, you made my day. Thank you so much .
@KelvinTrambadiya
@KelvinTrambadiya 6 жыл бұрын
Thanks much.! Really helps a lot to start understand internals and data structure behind it.
@deltonvaz7126
@deltonvaz7126 5 жыл бұрын
Amazing video! RIP keyboard
@jonathanlamb8789
@jonathanlamb8789 3 жыл бұрын
Really clearly explained and well presented - thanks for creating this!
@HarshKapadia
@HarshKapadia 3 жыл бұрын
Awesome talk, David! Thank you!
@akimbbo_upnext
@akimbbo_upnext Жыл бұрын
So lets say if in my git repo in i would make a change in every file each time i do a commit then git would have to allocate space on disc equal to how much space repo does take (more or less) and multiply it by number of commits? Also great video!
@kennethcarvalho3684
@kennethcarvalho3684 Жыл бұрын
This was very helpful in understand ing git.. Thanks
@PauloMesquita2067
@PauloMesquita2067 10 ай бұрын
I'm a little late to the party but: If this is "the information manager from hell" I can't imagine how the others are..... 🙂 Great job on explaining the object structure and how git does things in a practical and simple manner. Thank You Ver Much!
@p-a5603
@p-a5603 3 жыл бұрын
This took me an hour. 30 minute watching git internals video, 30 minute writing python function handling creating/deleting folder with 100 files :D
@ahmedbenziada9784
@ahmedbenziada9784 6 жыл бұрын
Wonderful explanation. That's what I was looking for. Thanks man.
@UPPERKEES
@UPPERKEES 6 жыл бұрын
What I still don't understand is how git is able to change the file system view. When you cd into a directory, you'll see the files/dirs of that commit reference. When you go to a different git branch, the file system view changes along with it. ext4 and other file systems also use references (inodes) to display files. Is git just a sort of overlay file system? If so, how would that work with so many different file systems and operating systems?
@TheHowlTube
@TheHowlTube 6 жыл бұрын
It really doesn't make any special changes to the file system itself - it's not FUSE. When you git checkout a branch, it first changes the HEAD to be the new hash or the new branch. Once the HEAD is sorted, it'll go ahead and figure out what changes it needs to make to your worktree. After that, it's a matter of changing all the files in the directory, which can be done without knowledge of the filesystem.
@amirrezalotfi8919
@amirrezalotfi8919 2 жыл бұрын
Awesome video!!!!! It is exactly what I was looking for.
@RahulGupta-wd3lf
@RahulGupta-wd3lf Жыл бұрын
So just to be clear there are duplications in blobs every time we change a file?
@ueiwqoak
@ueiwqoak 2 жыл бұрын
Great video. Is there a software tool to visualize ALL the sha references? I know you can see the commit DAG, but I want to see the commit+tree+blob DAG, like what was visualized at @10:37
@ueiwqoak
@ueiwqoak 2 жыл бұрын
Like are there any pyviz like tools that can automatically generate the clean, beautiful diagram you made at @10:37 but for and Git repo? It’s clear you could make the diagram by crawling through the objects file but that seems frustrating and unnecessary
@JeffreyDeveloperCOL
@JeffreyDeveloperCOL 5 жыл бұрын
Thanks for this excellent video. Awesome the last surprise part
@NicolasIvanov
@NicolasIvanov 3 жыл бұрын
AHA moment worked, thank you!!
@ws9691
@ws9691 3 ай бұрын
Awesome explanation!
@tileq
@tileq 3 жыл бұрын
Excellent presentation.
@yeoahjang5695
@yeoahjang5695 4 жыл бұрын
Awesome video, loved the exercise, I learned a lot from it, thank you!
@rajbopche7992
@rajbopche7992 4 жыл бұрын
In your Git model PDF you showed a single commit having multiple trees following parent-child pattern. However, practically when you showed the contents of a commit it just held reference to one single tree + one single tree only held reference to one/multiple blobs. What are we missing ?
@jamesburgess9101
@jamesburgess9101 4 жыл бұрын
tree objects are flat lists of references. References to both blobs and other trees. If the db needs to represent a sub-directory in your repo you would see a tree reference inside a tree. The example did not have any files in sub-directories.
@DennisAllard
@DennisAllard 5 жыл бұрын
Outstanding presentation of the fundamental git add/commit semantics. Do you have a overview video on fetch/merge/pull? Suggestion: you mention branches in the intro and towards the end of the presentation you give a simple example of creating a new branch (named foobranch). It would be useful to point out the effect of the first commit of foobranch to HEAD and the pointer values of foobranch and master both before and after the commit. That all begs for a second excellent video on branching. The subtleties of file timestamps are also interesting to comment on. Hint, Git does not record file timestamps. BYW I like the sound of your keyboard. (-:
@pgangloff
@pgangloff 5 жыл бұрын
Thank you! [bibs on the wall=trail?] I'll google some more and try it for myself but it would be great to see an example where you rename a file. I think in those cases, we lose the history of the changes to a file? i.e: this would be considered "deleted a file" + "added a file". I'm not sure I understand Linus' philosophy on that one... That's where I'm still confused... Just starting up on git; our team uses SVN and, migrating to git, many are worried that git "loses commit history" when refactoring/renaming files. [ignore svn2git issues, I'm talking about a project already in git]
@baharalirezaei3608
@baharalirezaei3608 5 жыл бұрын
Great explanation,Thanks a lot🌺
@haccks.
@haccks. 3 жыл бұрын
How come git add results in adding blob to the objects directory? Shouldn't it be done after running git commit command?
@shayestaparveen315
@shayestaparveen315 4 жыл бұрын
This video is amazing! Thank you so much.
@blackhalo117
@blackhalo117 3 жыл бұрын
Thank you very much for this video!
@RossiMurilo
@RossiMurilo 3 жыл бұрын
Great content! Thanks for sharing!
@nickV703
@nickV703 3 жыл бұрын
So many aha moments! And so well explained!
@_ashout
@_ashout Жыл бұрын
It's crazy I really thought that internally git would store diffs.
@roycechristongoveas5836
@roycechristongoveas5836 Жыл бұрын
Crazy video amazing explanation 🤩
@ChrisAthanas
@ChrisAthanas Жыл бұрын
12:57 this is how the video should start Ave then the slide show after or in between the code and slides The slides are eye glazing material without the code
@prakashk78
@prakashk78 6 жыл бұрын
Thank you , all of git commands are playing with tree, blob, commit object :) thanks for nice explaination
@asadmoosvi
@asadmoosvi 4 жыл бұрын
Fantastic content. Learnt a lot from this.
@navinmeshram7541
@navinmeshram7541 4 жыл бұрын
The famous Butterfly keyboard it is.
@vedantneema
@vedantneema 2 жыл бұрын
amazing explanation
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
Thanks a lot. Very informative video.
@sergiomorenosuay3030
@sergiomorenosuay3030 2 жыл бұрын
Fantastic video!
@tanchienhao
@tanchienhao 2 жыл бұрын
Awesome lesson!!
@biplavtimalsina9644
@biplavtimalsina9644 4 жыл бұрын
Such a good video. Thanks ton man!
@hyperbitcoinizationpod
@hyperbitcoinizationpod 3 жыл бұрын
Is git also making a chain of hashes, like a blockchain?
@FugalBaboon
@FugalBaboon 2 жыл бұрын
Confused why he kept re-adding files (git add ....). In all my git experience I add it the first time and never have to add again.
@giscardboulou5886
@giscardboulou5886 6 жыл бұрын
why you so angry at your keyboard man! For real tho it's distracting :) good video!
@gustavomuller7190
@gustavomuller7190 8 ай бұрын
Great video!
@LaurenceBrown-rx7hx
@LaurenceBrown-rx7hx 3 жыл бұрын
Does anyone know what music was used for the intro?
@amarjawla
@amarjawla 3 жыл бұрын
Amazing video .. cheers !!
@harshraj22_
@harshraj22_ 4 жыл бұрын
I read that sha1 is a cryptographic algo, for which encrypting is easy, but encrypting from encrypted is nearly impossible. If git hashes all contents to sha1 hashes, how does it decrypts the contents so fast and correctly while say changing branch ?
@Knirin
@Knirin 3 жыл бұрын
Git doesn’t store the objects in an encrypted form. They are compressed and the hash is used as a name in a phone book to look them up. You can’t decrypt a sha1 hash into its original input you can however find another input that will give the same hash. This is called a collision. Password cracking is looking for variants on known passwords and the dictionaries of various languages to find words that have matching hashes. The longer and more random a password is the more attempts are required to find a match.
@christiansakai
@christiansakai 5 жыл бұрын
This is what I need!
@NLmkkillah
@NLmkkillah 5 жыл бұрын
This would be amazing if it would've been correct since you say trees have the complete current state as blobs, but at 11:05 you show trees pointing to other trees.
@daya0576
@daya0576 6 жыл бұрын
Thx a lot, glorious tutorial!
@sureshkumar-hu3ld
@sureshkumar-hu3ld 4 жыл бұрын
Awesome. Really useful
@coreyp.789
@coreyp.789 4 жыл бұрын
Very nice! Thanks.
@majorgnu
@majorgnu 4 жыл бұрын
9:50 "The contents of these files is *encrypted"* That's not the term you were looking for. Git storing objects in a compressed, application specific format is not a form of encryptiom.
@abdulmatin3208
@abdulmatin3208 4 жыл бұрын
It should be like that right? "Git stores the content in a compressed format and creates the SHA1 based on the compressed contents meaning compressed data are the parameter to produce the sha1 keys"?
@majorgnu
@majorgnu 4 жыл бұрын
@@abdulmatin3208 SHA1 is not a cypher. It doesn't encrypt stuff. SHA-1 is a cryptographic hash function. A hash function maps data of a variable size to values of a fixed size (hashes) - 20 bytes long in the case of SHA-1. The "cryptographic" part means that it's considered to have a set of properties that makes it useful in cryptographic applications. Perhaps the most important property being that it's very hard to find hash collisions, i.e. two inputs that produce the same output. Git uses SHA-1 as the hash function of its *content addressable storage* system. Content addressable storage is a way to organize stored data where the identifier for a piece of data (a git object in our case) is derived from the data itself. To summarize: git objects are stored is a simple, unencrypted format that happens to use compression to save space. SHA-1 is only used to *identify* the objects in git's content addressable storage system.
@arindammukherjee3261
@arindammukherjee3261 4 жыл бұрын
Start at 3:40.
@rohit1987j
@rohit1987j 6 жыл бұрын
nice way of explanation.
@sydneysights8697
@sydneysights8697 Жыл бұрын
Excellent !!
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
How to view the content of blob if it's not text file? Just say it is image of zip file or something.
@prashantvaishla499
@prashantvaishla499 5 жыл бұрын
very informative . thank you
@kushagragautam3979
@kushagragautam3979 6 жыл бұрын
What is the purpose of local repository? Let's take a case that we have central repository and our workspace only. What difference will local repository make?
@TheSrishanbhattarai
@TheSrishanbhattarai 6 жыл бұрын
You might want to check out Linus Torvald's talk on Git, particularly where he emphasizes the distributed nature of Git, and how it's superior to centralized version control systems like SVN etc.
@thats-no-moon
@thats-no-moon 2 жыл бұрын
This is gold
@gagangupta1255
@gagangupta1255 4 жыл бұрын
Awesome video
@aquere
@aquere 5 жыл бұрын
Thank you for this video
@iblockdev7342
@iblockdev7342 6 жыл бұрын
is there any alternative to watch command on windows and mac os x?
@Aarmaxian
@Aarmaxian 3 жыл бұрын
Too good to be true!!
@italian_boy402
@italian_boy402 5 жыл бұрын
What utility did you use to split the shell?
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
1. He's using screen command. You need to install it by "apt install screen". 2. I would suggest you to intall terminator on linux. It's a very smooth terminal splitter and works like charm.
@GintsPolis
@GintsPolis 7 жыл бұрын
Thank you!
@alexandersviridov8682
@alexandersviridov8682 3 жыл бұрын
brilliant!
@eashanmathur2030
@eashanmathur2030 4 жыл бұрын
Thanks sir 🙏🏼
@techwithraj11
@techwithraj11 Жыл бұрын
stupendous
@rdd13r
@rdd13r Жыл бұрын
It's "working copy" not working directory
@idc19
@idc19 4 жыл бұрын
Thank you
@hsaidinsan6345
@hsaidinsan6345 4 жыл бұрын
20:45 Doug DeMuro This is the new Bmw x5 ......
@mvizavis6351
@mvizavis6351 2 жыл бұрын
Voila !
@shivanshhanda7553
@shivanshhanda7553 4 жыл бұрын
What terminal is he using? Doesn't look like gnome-terminal
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
1. He's using screen command. You need to install it by "apt install screen". 2. I would suggest you to intall terminator on linux. It's a very smooth terminal splitter and works like charm.
@shivanshhanda7553
@shivanshhanda7553 4 жыл бұрын
@@AliAnwarwish thanks.
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
@@shivanshhanda7553 Hey bro. You can install tmux too. I'm using it rn.
@shivanshhanda7553
@shivanshhanda7553 4 жыл бұрын
Hey man, I switched back to gnome-terminal as terminator was showing strange characters when using. Will give tmux a try, thanks. Edit: Also, I found gnome-terminal to be faster than terminator, eg when I cd to a big git repo, terminator takes more time to load.
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
@@shivanshhanda7553 Yes I do agree. But tmux is better at session management too. Yeah nice, worth a try.
@majorgnu
@majorgnu 4 жыл бұрын
Saying that git is a DAG sounds like a challenge to researchers working on intentional cryptographic hash collisions. It's all fun and games until someone finds a commit that has itself as a parent. :)
@Knirin
@Knirin 3 жыл бұрын
Replacing sha1 with a different hash algorithm wouldn’t be difficult. You can use the bit length of the hashes to distinguish them. Compatibility might be a pain temporarily. I am not sure if the known attacks on sha1 allow constructing arbitrary input that collides.
How GIT works under the HOOD?
16:01
Tech With Nikola
Рет қаралды 205 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 96 МЛН
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,2 МЛН
Introduction to Git - Core Concepts
28:37
David Mahler
Рет қаралды 345 М.
Git 101 Basics - Computer Stuff They Didn't Teach You #4
33:50
Scott Hanselman
Рет қаралды 205 М.
Level Up Your Git Game: 10 Little-Known Features You’ll Love
17:56
Git From the Bits Up
55:45
InfoQ
Рет қаралды 96 М.
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 1,2 МЛН
Git Internals - Git Objects
7:10
Brief
Рет қаралды 32 М.
So You Think You Know Git Part 2 - DevWorld 2024
23:02
GitButler
Рет қаралды 85 М.
Introduction to Git - Branching and Merging
28:48
David Mahler
Рет қаралды 489 М.
Database Indexing for Dumb Developers
15:59
Laith Academy
Рет қаралды 73 М.