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

  Рет қаралды 115,098

GitLab

GitLab

Күн бұрын

Fascinated with git? Frustrated with git? Take a moment to understand how git it works under the hood! In this short 30-min session, David Thomas (Solutions Architect, GitLab) walks you through a series of command line examples illustrating the 'simple' nature of how git is designed. Take a back stage tour of this popular software configuration management (SCM) tool and learn not fear the SHA! Please comment below with any feedback. If you'd like to see additional videos on git patterns, practices, internals, etc please let us know. Happy coding!
Try GitLab EE FREE for 30 days, no credit card required - goo.gl/JdznoY
Want to know more about our free GitLab.com? goo.gl/Uol8bl
GitLab License FAQ - goo.gl/hZAsYF
Questions?? - goo.gl/i7KzQ8

Пікірлер: 119
@glebkoshelev
@glebkoshelev 4 жыл бұрын
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 5 жыл бұрын
What did that poor keyboard ever do to you? :)
@artembordiuh2802
@artembordiuh2802 3 жыл бұрын
Wonderful tutorial! But the Whac-A-Mole game with the keyboard is very loud.
@usoppgod8107
@usoppgod8107 2 жыл бұрын
I cannot stress enough how wonderfully things were explained. Cheers man!
@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.
@LeeZhenYong
@LeeZhenYong 2 жыл бұрын
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!
@shyamgadepalli9786
@shyamgadepalli9786 4 жыл бұрын
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!
@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.
@melisoner8981
@melisoner8981 3 жыл бұрын
I wasn't afraid of the shas before but this took it to a different level. Thank you.
@prasadkailkeresridhar8316
@prasadkailkeresridhar8316 3 жыл бұрын
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.
@JiaweiCao
@JiaweiCao 4 жыл бұрын
Thank you! You explained what happens in git internally in a very easy and clear way!
@ahmedbenziada9784
@ahmedbenziada9784 5 жыл бұрын
Wonderful explanation. That's what I was looking for. Thanks man.
@jonathanlamb8789
@jonathanlamb8789 2 жыл бұрын
Really clearly explained and well presented - thanks for creating this!
@KelvinTrambadiya
@KelvinTrambadiya 5 жыл бұрын
Thanks much.! Really helps a lot to start understand internals and data structure behind it.
@parthbhimani9778
@parthbhimani9778 4 жыл бұрын
Thank you for this. Clearly understood the basic internal workings of git.
@vil9386
@vil9386 2 жыл бұрын
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!
@architgupta4087
@architgupta4087 4 жыл бұрын
Amazing. Cleared a lot of things for me.
@andyd568
@andyd568 4 ай бұрын
Beyond helpful because of its level of detail and precision.
@HarshKapadia
@HarshKapadia 2 жыл бұрын
Awesome talk, David! Thank you!
@MultiTelefono
@MultiTelefono 4 жыл бұрын
Thanks for this excellent video. Awesome the last surprise part
@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 :)
@yeoahjang5695
@yeoahjang5695 3 жыл бұрын
Awesome video, loved the exercise, I learned a lot from it, thank you!
@ekbastu
@ekbastu 2 жыл бұрын
Hey Thomas, you made my day. Thank you so much .
@nneddenn6207
@nneddenn6207 5 ай бұрын
Nice and crisp explanation! It was good
@daya0576
@daya0576 6 жыл бұрын
Thx a lot, glorious tutorial!
@shayestaparveen315
@shayestaparveen315 4 жыл бұрын
This video is amazing! Thank you so much.
@biplavtimalsina9644
@biplavtimalsina9644 4 жыл бұрын
Such a good video. Thanks ton man!
@baharalirezaei3608
@baharalirezaei3608 4 жыл бұрын
Great explanation,Thanks a lot🌺
@amirrezalotfi8919
@amirrezalotfi8919 2 жыл бұрын
Awesome video!!!!! It is exactly what I was looking for.
@tueday3191
@tueday3191 2 жыл бұрын
this is so good!!! Thank you for the great video
@RossiMurilo
@RossiMurilo 2 жыл бұрын
Great content! Thanks for sharing!
@asadmoosvi
@asadmoosvi 4 жыл бұрын
Fantastic content. Learnt a lot from this.
@kennethcarvalho3684
@kennethcarvalho3684 8 ай бұрын
This was very helpful in understand ing git.. Thanks
@AliAnwarwish
@AliAnwarwish 4 жыл бұрын
Thanks a lot. Very informative video.
@tileq
@tileq 2 жыл бұрын
Excellent presentation.
@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
@NicolasIvanov
@NicolasIvanov 2 жыл бұрын
AHA moment worked, thank you!!
@Igor160193
@Igor160193 2 жыл бұрын
I never feared the SHA, but now I understand the SHA. Thank you
@bulletbeatboxer
@bulletbeatboxer Жыл бұрын
I send all my new devs this video! SO key in understanding how to use git.
@nickV703
@nickV703 2 жыл бұрын
So many aha moments! And so well explained!
@blackhalo117
@blackhalo117 2 жыл бұрын
Thank you very much for this video!
@PauloMesquita2067
@PauloMesquita2067 4 ай бұрын
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!
@roycechristongoveas5836
@roycechristongoveas5836 Жыл бұрын
Crazy video amazing explanation 🤩
@tanchienhao
@tanchienhao 2 жыл бұрын
Awesome lesson!!
@MrHav1k
@MrHav1k 3 жыл бұрын
I'm not even a developer, just an infrastructure guy, but this was an excellent explanation.
@vedantneema
@vedantneema 2 жыл бұрын
amazing explanation
@sergiomorenosuay3030
@sergiomorenosuay3030 Жыл бұрын
Fantastic video!
@christiansakai
@christiansakai 4 жыл бұрын
This is what I need!
@prashantvaishla499
@prashantvaishla499 5 жыл бұрын
very informative . thank you
@DennisAllard
@DennisAllard 4 жыл бұрын
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. (-:
@deltonvaz7126
@deltonvaz7126 4 жыл бұрын
Amazing video! RIP keyboard
@aquere
@aquere 4 жыл бұрын
Thank you for this video
@rohit1987j
@rohit1987j 6 жыл бұрын
nice way of explanation.
@amarjawla
@amarjawla 3 жыл бұрын
Amazing video .. cheers !!
@RohitSoni1
@RohitSoni1 Жыл бұрын
Goes deep on just one thing ..what's behind the 40 char SHA and makes it easy!! Thanks much!! 😊
@lorenzoluisalbano3695
@lorenzoluisalbano3695 10 ай бұрын
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
@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.
@GintsPolis
@GintsPolis 6 жыл бұрын
Thank you!
@gustavomuller7190
@gustavomuller7190 Ай бұрын
Great video!
@sureshkumar-hu3ld
@sureshkumar-hu3ld 4 жыл бұрын
Awesome. Really useful
@coreyp.789
@coreyp.789 4 жыл бұрын
Very nice! Thanks.
@sydneysights8697
@sydneysights8697 Жыл бұрын
Excellent !!
@prakashk78
@prakashk78 6 жыл бұрын
Thank you , all of git commands are playing with tree, blob, commit object :) thanks for nice explaination
@gagangupta1255
@gagangupta1255 4 жыл бұрын
Awesome video
@eashanmathur2030
@eashanmathur2030 4 жыл бұрын
Thanks sir 🙏🏼
@alexandersviridov8682
@alexandersviridov8682 2 жыл бұрын
brilliant!
@iblockdev7342
@iblockdev7342 6 жыл бұрын
is there any alternative to watch command on windows and mac os x?
@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 5 жыл бұрын
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.
@pablovirus
@pablovirus Жыл бұрын
thank you!
@thats-no-moon
@thats-no-moon Жыл бұрын
This is gold
@pgangloff
@pgangloff 4 жыл бұрын
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]
@ueiwqoak
@ueiwqoak Жыл бұрын
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 Жыл бұрын
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
@_ashout
@_ashout 7 ай бұрын
It's crazy I really thought that internally git would store diffs.
@floppabellic
@floppabellic Жыл бұрын
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!
@p-a5603
@p-a5603 2 жыл бұрын
This took me an hour. 30 minute watching git internals video, 30 minute writing python function handling creating/deleting folder with 100 files :D
@techwithraj11
@techwithraj11 Жыл бұрын
stupendous
@idc19
@idc19 4 жыл бұрын
Thank you
@ChrisAthanas
@ChrisAthanas 8 ай бұрын
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
@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.
@haccks.
@haccks. 2 жыл бұрын
How come git add results in adding blob to the objects directory? Shouldn't it be done after running git commit command?
@Aarmaxian
@Aarmaxian 2 жыл бұрын
Too good to be true!!
@LaurenceBrown-rx7hx
@LaurenceBrown-rx7hx 3 жыл бұрын
Does anyone know what music was used for the intro?
@RahulGupta-wd3lf
@RahulGupta-wd3lf Жыл бұрын
So just to be clear there are duplications in blobs every time we change a file?
@hyperbitcoinizationpod
@hyperbitcoinizationpod 2 жыл бұрын
Is git also making a chain of hashes, like a blockchain?
@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 5 жыл бұрын
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.
@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.
@navinmeshram7541
@navinmeshram7541 3 жыл бұрын
The famous Butterfly keyboard it is.
@italian_boy402
@italian_boy402 4 жыл бұрын
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.
@AliAnwarwish
@AliAnwarwish 3 жыл бұрын
How to view the content of blob if it's not text file? Just say it is image of zip file or something.
@arindammukherjee3261
@arindammukherjee3261 4 жыл бұрын
Start at 3:40.
@FugalBaboon
@FugalBaboon Жыл бұрын
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 5 жыл бұрын
why you so angry at your keyboard man! For real tho it's distracting :) good video!
@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.
@mvizavis6351
@mvizavis6351 2 жыл бұрын
Voila !
@rdd13r63
@rdd13r63 7 ай бұрын
It's "working copy" not working directory
@hsaidinsan6345
@hsaidinsan6345 3 жыл бұрын
20:45 Doug DeMuro This is the new Bmw x5 ......
@NLmkkillah
@NLmkkillah 4 жыл бұрын
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.
@utubetest420
@utubetest420 4 жыл бұрын
Hmm nice insight on git functionality. Find git commands cheat sheet here handyopinion.com/git-commands-cheat-sheet/
@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.
@penggunaphp7297
@penggunaphp7297 5 жыл бұрын
Conor MCGregor.. OMG...
@tarikzaki5442
@tarikzaki5442 2 жыл бұрын
AHHHAAAAAA !
Git From the Bits Up
55:45
InfoQ
Рет қаралды 94 М.
How GIT works under the HOOD?
16:01
Tech With Nikola
Рет қаралды 182 М.
когда одна дома // EVA mash
00:51
EVA mash
Рет қаралды 9 МЛН
КАРМАНЧИК 2 СЕЗОН 4 СЕРИЯ
24:05
Inter Production
Рет қаралды 621 М.
原来小女孩在求救#海贼王  #路飞
00:32
路飞与唐舞桐
Рет қаралды 31 МЛН
SHA: Secure Hashing Algorithm - Computerphile
10:21
Computerphile
Рет қаралды 1,2 МЛН
Has Generative AI Already Peaked? - Computerphile
12:48
Computerphile
Рет қаралды 157 М.
Git Internals - Creating a Repo From Scratch
27:14
Brief
Рет қаралды 13 М.
How to be a git expert
46:26
Floating Little Leaves of Code
Рет қаралды 140 М.
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 963 М.
Git Branches Tutorial
33:20
freeCodeCamp.org
Рет қаралды 231 М.
Git Internals - Git Objects
7:10
Brief
Рет қаралды 27 М.
Complete GIT in 1 video
3:43:17
Hitesh Choudhary
Рет қаралды 44 М.
Introduction to Git - Remotes
31:16
David Mahler
Рет қаралды 162 М.
С Какой Высоты Разобьётся NOKIA3310 ?!😳
0:43
Koshyl_Live
Рет қаралды 3,7 МЛН
Главная проблема iPad Pro M4 OLED!
13:04
THE ROCO
Рет қаралды 33 М.
Apple, как вас уделал Тюменский бренд CaseGuru? Конец удивил #caseguru #кейсгуру #наушники
0:54
CaseGuru / Наушники / Пылесосы / Смарт-часы /
Рет қаралды 2,9 МЛН
Добавления ключа в домофон ДомРу
0:18