How GIT works under the HOOD?

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 มิ.ย. 2024
  • Have you ever wondered how Git really works? Are you confused about what a commit is? How about merging and rebasing, or maybe cherry-picking? This video breaks it down in simple terms! Join me to explore the core concepts of Git.
    🔍 What You'll Learn:
    - How Git stores your code as a tree of objects?
    - How Git manages your code changes with commits?
    - What are branches?
    - How merge actually works?
    - Is rebase similar to merge and why most people prefer it?
    - Is cherry-picking the same as merge?
    Whether you're a coding enthusiast looking to deepen your knowledge or a newcomer trying to make sense of Git, this video is your go-to resource. Gain insights into Git's mechanics and boost your confidence in handling version control.
    🚀 If you found this video helpful, don't forget to like, share, and subscribe for more tech tutorials!
    🔗 Connect with me:
    Support me on patreon: / techwithnikola
    LinkedIn: / nikola-stojiljkovic-67...
    Join my discord: / discord
    Visit my blog: techwithnikola.com
    Follow me on Instagram: / techwithnikola
    Follow me on Twitter: / techwithnikola
    Timecodes
    00:00 - Intro
    00:13 - What is Git?
    00:44 - Manual versioning
    01:36 - How Git stores data?
    04:16 - Git trees
    05:33 - Commits and Branches
    07:09 - Recap
    08:02 - How Git Merge works?
    11:22 - Rebase
    12:25 - How Cherry Picking works?
    14:12 - Generalizing Cherry-Picks via Merge
    15:43 - Outro
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 227

  • @CactusPuppy
    @CactusPuppy 10 หลายเดือนก่อน +274

    TH-cam recommendations brought me here, and I certainly am not disappointed. Thanks for an informative yet concise explanation!

    • @TechWithNikola
      @TechWithNikola  10 หลายเดือนก่อน +8

      I’m glad you’ve found it useful. If you have any suggestions for improvements please let me know.

  • @georgesms
    @georgesms 9 หลายเดือนก่อน +26

    DUUUUDE, I was not expecting to understand git in one video. There are still the specific commands to learn but this video created a solid start for me. Thank you!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +2

      Thanks a lot dude! Yeah, it’s a journey, but understanding internals is a very good start. It’s not strictly necessary but I personally I like knowing how tools that I use work under the hood.

  • @patricknelson
    @patricknelson 9 หลายเดือนก่อน +89

    It’s always great to gain a deeper understanding of something I already use daily. Thank you for this! ❤

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +4

      You’re welcome. I very happy that people find it useful! ❤️

  • @ajaygovinds
    @ajaygovinds 9 หลายเดือนก่อน +41

    Glad I came across this video of yours, amazing quality in the narration. Keep doing more. Thanks for your efforts ❤👏

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thank you so much for your kind words and support. I'm thrilled that you've enjoyed it. Your encouragement means a lot to me! ❤

  • @method_actor
    @method_actor 9 หลายเดือนก่อน +7

    One of the best videos about Git I've ever seen, great job

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thanks. This means a lot to me!

  • @gertrudestrawberry
    @gertrudestrawberry 28 วันที่ผ่านมา

    Thank you! I've been using git for over a decade and you've finally made it clear!
    If I ran the internet, this video would be shown at the top of any "how to" search about git.

  • @oliverxie9210
    @oliverxie9210 8 หลายเดือนก่อน +4

    It is super nice to have a short video to dive deep into the underlying principle of git. especially, the objects and how merge and rebase work. Thanks a lot for the video!

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      You're welcome. I'm glad you've liked it :)

  • @davidpape1160
    @davidpape1160 2 หลายเดือนก่อน

    I'd just like to say thanks for making this video so visually simple. That includes thanks for not including a load of stock footage of different groups of youngish people inspecting laptop screens together, and extra bonus thanks for not cutting out to 1.5 second clips from Marvel MCU movies every 15 seconds. It's actually refreshing to see a TH-cam video that's directly, consitently focused on communicating knowledge about its topic.

    • @TechWithNikola
      @TechWithNikola  หลายเดือนก่อน

      Hi, thank you very much for leaving such comment. I’m glad to hear that you appreciate the focus on the important stuff. :-)
      Apologies for the late reply.

  • @MrRenlmaxim
    @MrRenlmaxim 9 หลายเดือนก่อน +10

    A great, concise and well animated explanation. Great job!
    PS: Guess you've been blessed by the youtube algorithm, and deservedly so. I'll watch your other videos too.

  • @LeMinecrafteurCool
    @LeMinecrafteurCool 9 หลายเดือนก่อน +5

    This video is amazing, thank you. Hope you get the recognition you deserve!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thank you very much for the kind words!

  • @JThompson_VI
    @JThompson_VI 8 หลายเดือนก่อน +1

    This video made clear to me concepts many others have tried and failed to help me understand. Really well done thanks man!

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thanks, I'm so glad that you've found it helpful!

  • @bradfordjohnson5356
    @bradfordjohnson5356 9 หลายเดือนก่อน +1

    Recommendations brought me here too. I like the use of visuals and your details! Keep it up!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thanks a lot! I’ll do my best to make sure future videos are even better.

  • @DJazium
    @DJazium 5 หลายเดือนก่อน +1

    I've been using git for 15 years and I learned a lot. Thanks!

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน +1

      You're welcome. Great to hear that!

  • @racicmina
    @racicmina 10 หลายเดือนก่อน +2

    The explanation provided was excellent. I truly enjoyed the video!

    • @TechWithNikola
      @TechWithNikola  10 หลายเดือนก่อน +1

      Thank you Mina. I'm glad you've enjoyed it!

  • @ThanhNguyen-rz4tf
    @ThanhNguyen-rz4tf 9 หลายเดือนก่อน

    This channel is gold 🥇. Hope you keep this quality and make more video. I learn a lot from you. Thank you.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thank you, and you’re welcome. I’m very happy to hear that you like my videos. I’ll do my best to keep and improve the quality.

  • @DHAiRYA2801
    @DHAiRYA2801 9 หลายเดือนก่อน +1

    Very well made video, loved the quality ❤️. Keep it up man 💯.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thanks a lot! ❤️

  • @zebedeenicholls9555
    @zebedeenicholls9555 6 หลายเดือนก่อน

    Super nice video. Thanks for your efforts both here and on the channel more widely!

    • @TechWithNikola
      @TechWithNikola  6 หลายเดือนก่อน

      Thank you for taking the time to comment Zebedee. I'm very happy to hear that you like my videos.

  • @zagortenej98
    @zagortenej98 9 หลายเดือนก่อน +1

    Great video! Concise and simple explanation with enough details to understand what's going on under the hood.

  • @ilushamain4740
    @ilushamain4740 8 หลายเดือนก่อน +1

    I love your work so much. It is very informative and concise. It was a pleasure

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thank you so much! :)

  • @rickloyd8208
    @rickloyd8208 9 หลายเดือนก่อน +10

    After years of using Git, I finally understand rebase =) However, I personally prefer merge but this is probably due to how I use branches. Thanks for great video!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      You’re welcome. I’m glad you liked it!

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 8 หลายเดือนก่อน +3

      Rebase is useful for tidying up private branches before making things public. Once a branch is public, rebasing is going to annoy people who try to copy your branches.

    • @Degenerate76
      @Degenerate76 8 หลายเดือนก่อน

      @@lawrencedoliveiro9104 Indeed, projects I have contributed to usually want things rebased to the latest commit on the main public branch. They also prefer squashed commits, so your changes over multiple commits on your private branch appear as a single commit for merging to the main branch.
      I also like it this way, because it means I can mess around to my heart's content in my private branch until I have something I am ready to show the world, and any embrassing mistakes in the commit history of my private branch don't need to be part of the public history.

  • @igorsantanas
    @igorsantanas 5 หลายเดือนก่อน +1

    Thank you!
    This is both a simple introduction and an excellent explanation of how Git works.

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน

      You’re welcome! Glad to hear you’ve enjoyed it.

  • @manickpillai
    @manickpillai 9 หลายเดือนก่อน

    Thank you Nikola as other i too came from TH-cam recommendation. Excellent explanation. Subscribed to your channel. Nice work.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thanks a lot Manick. Hope you’ll enjoy my future videos too!

  • @aliweederci
    @aliweederci 4 วันที่ผ่านมา

    Very good explaination of git internals!

  • @osamaa.h.altameemi5592
    @osamaa.h.altameemi5592 8 หลายเดือนก่อน

    this is true gold. best explanation i have ever seen yet for GIT.

  • @spicemasterii6775
    @spicemasterii6775 8 หลายเดือนก่อน

    I never understood GIT or any version trackers before. I do now thanks to you awesome video. Wornder amd clear explanation. Thanks

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thanks a lot :) Glad you've liked it!

  • @cloudsquall88
    @cloudsquall88 8 หลายเดือนก่อน

    This was incredibly valuable, thank you!

  • @lame_lexem
    @lame_lexem 9 หลายเดือนก่อน

    this is one of the best videos explaining git
    the merge strategies are also really greatly depicted here
    thank you for your work🎉

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thanks a lot for the kind words. I’m very happy to hear that you’ve liked it.

  • @arjunsahlot
    @arjunsahlot 4 หลายเดือนก่อน

    YES I'VE BEEN WAITING FOR AN ANIMATED VIDEO THE COVERS THE .git FOLDER! THANKS SO MUCH!

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน

      You're welcome! I'm glad you've liked it.

  • @BhattShashwat
    @BhattShashwat 8 หลายเดือนก่อน

    finally found a video which made me understand the whole thing. Thank you!

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      You're welcome! I'm glad you've liked it.

  • @overrevvv
    @overrevvv 9 หลายเดือนก่อน

    Thank you so much for this amazing video. Keep up the good work.

  • @Wes_Jones
    @Wes_Jones 8 หลายเดือนก่อน

    Finally, a clear explanation! Thanks.

  • @princekane1377
    @princekane1377 9 หลายเดือนก่อน

    Wow the way you teach will change the understaing of what's under the hood for deep learners this worth a great like
    Thanks❤🎉

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thank you. I’m really glad you think so ❤️

  • @user-lq7hm1ji9l
    @user-lq7hm1ji9l 10 หลายเดือนก่อน

    very clean i did understood something. Thank you.

    • @TechWithNikola
      @TechWithNikola  10 หลายเดือนก่อน

      Glad you've found it useful!

  • @alec1575
    @alec1575 หลายเดือนก่อน

    Thank you for this, it was very insightful. Nice to know how things work.

  • @sudhanshuraj4621
    @sudhanshuraj4621 9 หลายเดือนก่อน

    Thank you for the explanation.
    Please make more videos like this.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      You’re welcome. 🙂

  • @AnthonyBecker9
    @AnthonyBecker9 8 หลายเดือนก่อน

    Thank you, this was really helpful! Amazing to learn that one of my most used tools is based on foundational CS concepts like key-value stores and trees!

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      You’re welcome. I agree. Git is a good example for why data structures are important.

  • @Tri-Technology
    @Tri-Technology 9 หลายเดือนก่อน +1

    Very nice explanation of git! A real example of merging with some code and the command prompt would have been a nice addition for me, but I will try it by myself.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thanks. That’s a great suggestion.

  • @orterves
    @orterves 9 หลายเดือนก่อน +3

    I like to call the common commit the Base (because that's what it is)
    Rebase immediately makes perfect sense at that point - you are taking a list of commits from one base to a new base; you are re-basing

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      That makes sense, thanks.

  • @druzzyaka
    @druzzyaka 5 หลายเดือนก่อน

    This is high quality content. Thanks!

  • @Kebabrulle4869
    @Kebabrulle4869 5 หลายเดือนก่อน

    I've never used Git, but now I feel like I would have a much easier time learning it! Great video, and thanks for making it!

    • @TechWithNikola
      @TechWithNikola  5 หลายเดือนก่อน

      Thank you for the comment. That’s great to hear. I have no doubt that you’ll end up using Git at some point in your career, and I’m glad to hear that you’ve found this video helpful.

  • @a13600
    @a13600 8 หลายเดือนก่อน

    That’s an amazing video. I never understood git this way before

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thanks. Glad you liked it!

  • @ikhlasulkamal5245
    @ikhlasulkamal5245 9 หลายเดือนก่อน +1

    This is what i need. Thanks for the great video

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      You’re welcome! 🙂

  • @socraticmathtutor1869
    @socraticmathtutor1869 9 หลายเดือนก่อน

    Very helpful. Thank you!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Glad you've found it useful!

  • @finnthirud
    @finnthirud 9 หลายเดือนก่อน

    Great video! Finally I feel like I am ready to rebase something... 🥳

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thank you! Happy rebasing 😀

  • @zachwak
    @zachwak 9 หลายเดือนก่อน

    wow ya. youtube recommended me but i stayed for the whole video! cheers!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      I’m glad you’ve enjoyed it. Cheers!

  • @stundogha4947
    @stundogha4947 10 หลายเดือนก่อน

    Superb, good job on this video.

  • @juanmanuelgutierrez159
    @juanmanuelgutierrez159 10 หลายเดือนก่อน +1

    Great video! Thanks a lot

  • @divy1211
    @divy1211 9 หลายเดือนก่อน

    absolutely amazing video on git!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Glad you liked it! :)

  • @Martinit0
    @Martinit0 9 หลายเดือนก่อน

    Nice work Nikola!

  • @mrbigsmile3902
    @mrbigsmile3902 9 หลายเดือนก่อน +1

    I'm very surprised to see 'only' 700 subscribers. Keep it up!

  • @user-wc3bv2hk8i
    @user-wc3bv2hk8i 9 หลายเดือนก่อน

    Thanks a lot! That was amazing!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      You’re welcome! 😀

  • @shis10
    @shis10 8 วันที่ผ่านมา

    Amazing video . 🙌🏻🔥💯💯♥️

  • @rammrras9683
    @rammrras9683 9 หลายเดือนก่อน

    I discovered a great channel.
    I'm not so familiar with git and this helped me a lot.
    So to better use git better I use single small files.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Really glad it helped!

  • @cliffmathew
    @cliffmathew 8 หลายเดือนก่อน

    Great explanation!

  • @rilauats
    @rilauats 8 หลายเดือนก่อน

    THX, Nikola - you earned yourself a new subscriber.
    I remember struggling keeping "some progress" available during "code rollback" back in the late 1980s.
    That was NOT an easy task when you had a 8.3 filename restriction on every file.
    And then jumping to Unix, every Unix its own flavour of oddities.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน +1

      Thanks a lot Michael!
      That sounds tough. Fortunately, I didn't have to deal with such problems :) I've only used SVN prior to Git, which wasn't great but acceptable.

  • @kavehtehrani
    @kavehtehrani 9 หลายเดือนก่อน

    Really well done! Subbed.

  • @sorover111
    @sorover111 8 หลายเดือนก่อน

    This is so good !

  • @divyanshumaharshi3667
    @divyanshumaharshi3667 7 หลายเดือนก่อน

    You explained how git works wow!!! 🌟

    • @TechWithNikola
      @TechWithNikola  7 หลายเดือนก่อน

      Thank you for the comment. I'm glad it was helpful! :)

  • @CertificationTerminal
    @CertificationTerminal 9 หลายเดือนก่อน

    Thanks, much appreciated!

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      I’m glad you’ve found it useful!

  • @AK-vx4dy
    @AK-vx4dy 9 หลายเดือนก่อน

    Excelent job!

  • @rhtcguru
    @rhtcguru 8 หลายเดือนก่อน

    Very good, please keep making videos. Very clear explanation. I don't know where I picked up this habit but, as a matter of practice, while in I rebase with pulling in everything new from into the branch. Run tests to ensure my feature changes work with state. Then if all good, I go into and merge in which is always straightforward because already has the updates in . It seems kind of pointless after watching your video.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thanks :)
      Actually, if I understand your approach correctly then it sounds like that is indeed the correct way to use rebase. In the video, I omitted the step where feature branch is rebased on the main branch. I think that has to happen and we can then use merge with fast-forward to update the main branch. I didn't omit this intentionally, it was an oversight.

  • @shreybanugariya6367
    @shreybanugariya6367 3 หลายเดือนก่อน

    Thanks for sharing.

  • @sainathmandavilli6538
    @sainathmandavilli6538 6 หลายเดือนก่อน

    Crisp and informativeZ@

  • @mathicalee
    @mathicalee 8 หลายเดือนก่อน +1

    In the rebase example, it's not main which becomes F', but feature. And after rebase, feature has to be merged to main again.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน +1

      Yes, that’s correct. The main eventually becomes F’ but only after the feature (using merge fast-forward). I made a mistake in the animation where I was focused on the desired outcome.

  • @dhananjay7513
    @dhananjay7513 9 หลายเดือนก่อน

    Excellent video I have no words to demonstrate how well it's presented, but I find one important aspect missing is how git shows Delta changes in file between two commits, i can imagine that it probably traverse between nodes of tree and then compute difference but I have seen git calculating diff in large mono repo project in fraction of mili second which sounds like there might be an area of exploration here

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thanks a lot for the comment.
      Take the following with the grain of salt because I haven't validated if git does this, but since Git Trees are essentially Merkle Trees, this is probably how it works.
      If you want to compare two commits, this is essentially the same as comparing two git trees / merkle trees. Each git tree node has an ID, which is computed from its contents (other git trees or blobs). The same git trees will have exactly the same IDs, so comparing them is very fast. The problem is when two git trees don't have the same contents, then we have to compare the contents of both trees (again, note that we only compare the IDs of sub-trees and files). I think this is actually very fast in practice because we never need to compare the actual contents a file unless we know they are different in both trees. Eventually, we will identify the set of files whose content is different in each git tree, and we can run the diff tool only for these files.
      Above is a bit of a braindump, but hopefully it makes sense. Let me know if it doesn't though, and I'll try to elaborate.

  • @robinwersich3424
    @robinwersich3424 8 หลายเดือนก่อน

    Nice video! I would find it interesting to learn how git tracks renamed files and finds out which lines are changed

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thanks. I might create a video that shows how git diff for a single file works. Thanks for the suggestion.
      I don't know if git does anything special to track renamed files. The renamed file will have the same content (unless the content was changed as well), so its ID will remain the same. However, the tree object containing the list of files will change.

  • @paradox3210
    @paradox3210 17 วันที่ผ่านมา

    Good video. You sound exactly like Antti from "Road to Vostok" 👀

  • @69k_gold
    @69k_gold 9 หลายเดือนก่อน +1

    So git merge combines the latest commits in two branches, but rebase starts by combining the first two diverging commits after the common branch, and from there it takes a sequential path

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Yes, that sounds right to me.
      Minor correction: "after the common branch" -> "after the common commit"

  • @momcilomrkaic2214
    @momcilomrkaic2214 8 หลายเดือนก่อน

    Svaka cast, odican video! Mozda bi bilo kul i da si spomenuo kako git pronalazi razlike izmedju 2 grane pri mergu. Nisam zalzio konkretno u git, ali ima mi smisla da se preko Merkle stabla pronalazi koji fajlovi se razlikuju, a razlike izmedju fajlova sa LCS?

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Hvala! :-)
      Slazem se da bi bilo dobro, mada sam negde morao da presecem. Mozda napravim novi video o gitu u nekom trenutku.
      Da, preko merkle stabla mozemo da pronadjemo razlicite fajlove jako brzo. Diff izmedju dva fajla je baziran na LCSu (po linijama - Myers algorithm), mada mislim da ima par algoritama i kod gita je cini mi se to configurable.

  • @abusaid9347
    @abusaid9347 9 หลายเดือนก่อน

    Amazing content quality

  • @SamualN
    @SamualN 9 หลายเดือนก่อน +1

    this is a very good video

  • @geopolityk1160
    @geopolityk1160 9 หลายเดือนก่อน

    W wiezieniu z pewnoscia bylbys gitujacy 👌👌👌👌

  • @JohannesSchmitz
    @JohannesSchmitz 9 หลายเดือนก่อน

    Very nice and simple explanation of the internals. It would be cool if you could produce a follow up video where you go even more in depth. For example you could explain what happens with the trees and objects when a user command is executed. And I guess there are many more things to explain. Also things like 7:24, you say there is no metadata but where is that stored?

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thank you. Yes, I will likely produce a follow up video on git, but maybe with more focus on network synchronisations.
      7:24 gets me to recap so I couldn’t find what you are referring to, but my guess is that you mean metadata about blobs such as filename and metadata about commits? I have mentioned both in the video:
      - filenames are stored in tree objects
      - messages, author, etc are stored in commit objects
      Is this what you mean or did I misunderstand the comment?

    • @JohannesSchmitz
      @JohannesSchmitz 9 หลายเดือนก่อน

      Yes that was my question, I tried to go back and forth again but could not find where you mentioned these two details 😢, can you provide the timestamps?

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Sure. I speak about filesnames being stored in git trees at 4:20 th-cam.com/video/RxHJdapz2p0/w-d-xo.html
      Specifically, the sentence saying "tree solves the problem of not having a filename associated with a blob". There's also a tree visualization that shows filenames associated with blob object IDs.
      I talk about commits at 5:40 th-cam.com/video/RxHJdapz2p0/w-d-xo.htmlsi=pYAahuiGe71jjSB_&t=338
      I say that we store information about a single change into commits. Does this answer your question or is it maybe unclear in some way?

    • @JohannesSchmitz
      @JohannesSchmitz 8 หลายเดือนก่อน

      Okay thx but what about additional meta data of the filesystem like the bits for read write execute? I liked the summary you gave and I think it would have been perfect to add these details. Thx again, looking forward to more videos.

  • @qghungluu5757
    @qghungluu5757 หลายเดือนก่อน

    At 8:37, the animation looks like a rebase, should't it be a new commit which contains all the changes, thanks for the clear explantion though, great vid!

  • @syedfuaad1910
    @syedfuaad1910 6 หลายเดือนก่อน

    Apologies if you’ve already addressed this in the video, but when rebasing at 12:00, does it warn you if the changes from commit E and commit F will overwrite the changes made from commit C to commit D (main), since the feature branch isn’t aware of the changes in main from C onwards.

    • @TechWithNikola
      @TechWithNikola  6 หลายเดือนก่อน

      Hi, yes it does. It would result in a merge conflict. If you watch the part on how cherry picking is implemented you’ll see that it uses the same algorithm as merging, which ensures that changes are not lost.

  • @phenanrithe
    @phenanrithe 8 หลายเดือนก่อน

    Thanks! At 6:05, read "previous: initial-prototype" instead of "previous: initial-project" for the 2nd entry. Question: how does it avoid SHA-1 collisions, even though the probability is low? It looks like it would have to check the whole database each time, then invent something to change the digest in case of collision.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Good catch! Yes, it should say "previous: initial-prototype"
      I haven't experiment with hash collisions myself, but I think that git won't do anything about collisions locally.
      This answer might be helpful: stackoverflow.com/questions/9392365/how-would-git-handle-a-sha-1-collision-on-a-blob

  • @shubhamjagtap108
    @shubhamjagtap108 9 หลายเดือนก่อน

    What a video!

  • @erfanmola
    @erfanmola 9 หลายเดือนก่อน

    Epic ❤

  • @jackssrt
    @jackssrt หลายเดือนก่อน

    10:10 maybe this could do with some example commit messages, and example code? it might be easier to follow along if its presented in a real world scenario

    • @TechWithNikola
      @TechWithNikola  หลายเดือนก่อน

      Thanks for the suggestion. Yeah, that may have been better.

  • @davronsherbaev9133
    @davronsherbaev9133 9 หลายเดือนก่อน

    good videos, but one question regarding rebase. Should the feature branch be updated, not the main one?
    It seems like you are rebasing feature branch on top of main, but moving main instead of feature

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thank you for the comment. That’s a good point. In practice, the feature branch would be updated first (using git rebase command), then the main branch would be moved forward (e.g. using git merge command).
      My focus was on the mechanics/idea of the rebase, and I forgot to include that step. Hopefully the explanation still makes sense.

  • @davidpanic
    @davidpanic 8 หลายเดือนก่อน

    So how are commits actually stored on the filesystem then? Is it a text file stored as an object with a similar format to http headers? What about branches? Are they symlinks to a "commit" object?

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Commits are stored in the object database, same as blobs. I think it is a binary format, not text files. Note that the object database is just a bunch of files in git (in the .git/objects directory).
      I wouldn't say the format is similar to HTTP headers. I don't know the exact details of the binary format, but you can find out more here if you're curious: github.com/git/git/blob/d0e8084c65cbf949038ae4cc344ac2c2efd77415/commit.h#L26. You may need to trace how the commit struct is constructed to find out the serialization format.
      Branches are saved as files under ./git/refs/heads/. These are not symlinks. The file for the corresponding branch contains the commit ID it points to.

  • @rikschaaf
    @rikschaaf 8 หลายเดือนก่อน

    If you have a large file (say several megabytes or even gigabytes) and you change one bit in the file, does it save the whole new file in the blob store or does git have any clever tricks to only store the changes?

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน +1

      I think git does something to improve the storage of blobs, but it's not smart to realise that the 99% of the blob is the same. My guess is that this is probably optimized for text files rather than random binaries. I don't know if Git LFS does something though, but I'd expect it to have some kind of optimizations that work better for binaries. With that said, I don't know exactly what Git does, but here I've tested the above as follows:
      - Create an empty git project (its size is negligible)
      - Create a 1GB file with random data `dd if=/dev/urandom of=sample.txt bs=1G count=1`
      - Commit changes. The repo size is ~2GB. ~1GB for the blob and 1GB for the working directory. (see [1])
      - Change 1 byte in the sample.txt file.
      - Commit the change. The repo size is ~2.58GB. (see [2] for inspecting the blob)
      - One more time. The repo size is 3.11GB.
      [1]
      ~/test (main)
      $ git ls-tree 60914ef
      100644 blob 1d2579e731b4de097bda567f86bcf70d4c9fb4c6 sample.txt
      ~/test (main)
      $ ll -h ./.git/objects/1d/2579e731b4de097bda567f86bcf70d4c9fb4c6
      -r--r--r-- 1 Nikola 197121 1.1G Oct 2 23:27 ./.git/objects/1d/2579e731b4de097bda567f86bcf70d4c9fb4c6
      [2]
      ~/test (main)
      $ ll -h .git/objects/81/c9a65ac724cfcd7afaa1986609de53368ef2ae
      -r--r--r-- 1 Nikola 197121 543M Oct 2 23:21 .git/objects/81/c9a65ac724cfcd7afaa1986609de53368ef2ae

    • @rikschaaf
      @rikschaaf 8 หลายเดือนก่อน +1

      @@TechWithNikola That seems quite wasteful, but that could just be because it's optimized for speed, not storage size.

  • @ashishthakur9983
    @ashishthakur9983 10 หลายเดือนก่อน

    🔥🔥🔥

  • @rafsangoni6979
    @rafsangoni6979 6 หลายเดือนก่อน

    I have a question. Even though git creates subdirectories to store the files, if it needs to create more subdirectories for a large project it still cannot exceed the folder limit which is 65K , right?

    • @TechWithNikola
      @TechWithNikola  6 หลายเดือนก่อน

      Hi Rafsan, FAT32 uses one index per folder which can reference around 65k files or folders (the actual number is more subtle because it depends on the length of the file/folder names, but this is a good approximation). Each folder has its own index, so you could store ~65k files/folders per folder. This means that you could have a much bigger number of folders in total by organizing them into subfolders, in a tree-like structure.
      You are right that there is an overall hard limit for the number of files/folders on FAT32 file system, but this number is much bigger than 65k, I think it's around ~250 million files.

  • @themagicbonus7626
    @themagicbonus7626 10 หลายเดือนก่อน

    отличный видеоролик!

  • @melanovapedia7924
    @melanovapedia7924 9 หลายเดือนก่อน

    thanks TWN

  • @dariokartal9453
    @dariokartal9453 8 หลายเดือนก่อน

    Nikola, in the Object Database, the 'Key' column contains SHA1 keys, so far so good. What does the 'Object' column contain? The actual object contents, as shown in 1:50? Or merely the paths to object files? I ask because at 2:37 you did say, "The contents of each object are stored in a file." That sounds like the contents are not themselves in the database. Is perhaps the Object Database composed of just one column and not two as shown?
    Never mind, I've just googled it and found that there's also a filepaths reference store connected as though by a database primary key to the object store, and both the stores merely function like one database. Your graphics are only conceptual.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน +1

      Hi Dario!
      I think the confusion comes from the fact that the object database is not a table. I use a table-like view to visualize the properties of the database, but in practice, the object database is just a bunch of files. The key is the filename (left column) while the object (right column) are the contents of the file.
      To answer your questions:
      > What does the 'Object' column contain? The actual object contents, as shown in 1:50?
      The "Object" column contains the actual object contents.
      > Is perhaps the Object Database composed of just one column and not two as shown?
      I tried to explain above, but let me know if it still doesn't make sense.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน +1

      > Never mind, I've just googled it and found that there's also a filepaths reference store connected as though by a database primary key to the object store, and both the stores merely function like one database. Your graphics are only conceptual.
      Correct, graphics are only conceptual.

    • @dariokartal9453
      @dariokartal9453 8 หลายเดือนก่อน

      @@TechWithNikola Wow, you're quick! :) Thanks for the answers. The video is awesome, I'm still watching it.

  • @shyam5631
    @shyam5631 8 หลายเดือนก่อน

    awesome

  • @cornjulio4033
    @cornjulio4033 8 หลายเดือนก่อน

    hi. super nice colors here !
    Where are you (not-UK) from ?

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Hi, thanks! I'm from Serbia :)

  • @christophergrand9582
    @christophergrand9582 8 หลายเดือนก่อน

    I Think there is one error for rebase :
    when you do :
    git checkout feature && git rebase main
    after rebase, we have :
    - main branch points d
    - e becomes e' and its father is d
    - f becomes f' and its father is e'
    - feature branch no longer points to f, this one points to f'
    no any branch points to e and f
    e and f are not lost, you can find them when you do
    git reflog

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Yes, thanks. That was a mistake in the animation that was pointed out in a few comments so far. You're right, main branch will point to d, feature branch will point to f' after `git rebase main`, then we have a final step to merge the main and the feature branches with `git merge` which simply apply the fast-forward merge and update main to point to f' as well.
      Regarding the:
      - e becomes e' and its father is d
      - f becomes f' and its father is e'
      e and f will remain unchanged, so I don't think it's accurate to say that e becomes e'. Do you mean e' will correspond to e (and f' to f)?

  • @damonguzman
    @damonguzman 9 หลายเดือนก่อน +1

    Audio quality is extremely important, more important than video.....

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Agreed. Is there anything regarding the audio quality that I can improve?

    • @damonguzman
      @damonguzman 9 หลายเดือนก่อน

      ​@TechWithNikola There's a very strong but very short reverberation in your audio recording. My guess is that the audio is being recorded in a room about the size of a closet. It was jarring to listen to when I first played it so I ended up skipping the video.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Thank you for the feedback. I don't hear it myself but it may be dependent on the audio device - I will look more into this. FWIW, the room is not the size of a closet, it's ~15 sqm, so I doubt that's the isuse.

  • @DhavalAhir10
    @DhavalAhir10 9 หลายเดือนก่อน

    QUESTION :
    I tried myself and found commit is not a full snapshot but only changes which they know.
    create master branch file_1 created ( 1st commit) .
    Now checkout "feat" branch.
    Do a 2nd commit file_2 created.
    Do a 3rd commit file_3 created.
    Do a 4th commit file_4 created.
    Do a 5th commit file_5 created.
    Do a 6th commit file_6 created.
    Now "git switch master".
    git cherry-pick "7th commit hash"
    And boom..
    In master you see only file_1 and after file_7 created.
    Not a full snapshot. ( I mean even 7th is latest commit in feat but it doesn't have full snapshot, just their changes what they remember at that time).
    That's why file_2 to file_6 are not comes in the master.
    Because we use cherry pick and not merge.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน

      Hi, thanks for the question. Your experiment produces the expected results, i.e. cherry-picking a single commit will add the *diff* from that commit and the parent commit, not the whole commit. This is why you’re seeing this behaviour even though commits are full snapshots. I have explained this in the video - have you seen the part that explains how cherry-picking works?

    • @DhavalAhir10
      @DhavalAhir10 9 หลายเดือนก่อน

      ​​​@@TechWithNikola yes yes. Today I tried very hard and I found commit is a full snapshot. You are right about cherry-pick. Even when you Cherry-pick direct merge commit which have 2 parents, you have to specify using -m that which parent do you want to get diff from.
      NOTE :
      I create file_1 in master with first commit.
      file_2 - 2nd commit
      file_3 - 3rd commit
      file_4 - 4th commit
      file_5 - 5th commit
      Now 6th commit I changes some content in file_1.
      `git diff HEAD HEAD~1`
      I checked difference between latest commit and 2nd last latest.
      Even commit - 5th just only add file_5, It was showing file_1 content changed.
      That means the commit is full snapshot...
      in 5th commit ( full snapshot) the file_1 was as it is..
      in 6th commit I changes file_1 content...
      And it will show everything where I am on 5th commit at that time to 6th commit full snapshots changes..even I didn't touched file_1 in my 5th commit. ( only file_5 added and rest of snapshot stays as it is)
      Wow man you are such a genius.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      @@DhavalAhir10 that’s great. I’m glad that it all makes sense now!

  • @0MoTheG
    @0MoTheG 8 หลายเดือนก่อน

    What is the difference between "Check-in" and "commit"?

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      The terminology and the exact action depends on whether you're using Git, Mercurial, SVN, or maybe Microsoft TFS.
      Git doesn't have check-in command, so it doesn't make much sense to think about the difference between commit and check-in in Git.
      Commit pushes changes to the local repository in Git, and you have to use `git push` command to sends local changes to the server.
      In SVN, I think commit command sends changes to the server (unlike git or mercurial which stores the changes in the local repo), but I'm not 100% sure.
      In TFS, the `checkin` command[1] sends changes to the server.
      [1] learn.microsoft.com/en-us/azure/devops/repos/tfvc/checkin-command?view=azure-devops

  • @devanshgarg31
    @devanshgarg31 9 หลายเดือนก่อน +1

    Damn

  • @planktonfun1
    @planktonfun1 9 หลายเดือนก่อน

    I made one using only javascript

  • @AndreasToth
    @AndreasToth 4 หลายเดือนก่อน

    In the very opening of this video it states that Git tracks changes, but that's not really how Git works. Git doesn't track changes, i.e., differences, but complete snapshots of files. Yes, the side-effect of this is that it allows us to deduce the changes between versions. But to say that it tracks changes makes it sound like it works like a traditional source control system that stored changes, i.e., differences.
    P.S. I know the video makes this clear, but, as an opening statement, it is wrong.

    • @TechWithNikola
      @TechWithNikola  4 หลายเดือนก่อน +1

      Hi Andreas, thank you for the feedback. I appreciate taking the time to comment.
      You are certainly right that git doesn't track changes in the sense that it has changesets (e.g. like mercurial). My intent at that point in the video was to talk about the ideas and abstractions, rather than implementation details, and I think all version control systems have a decent amount of overlap in the problems they are trying to solve.
      It's still true that Git tracks changes in "some sense". Maybe they are not represented as changes under the hood, but you could argue that this is an implementation detail. Some people may argue that it also doesn't store[1] full snapshots.
      Whether it's right to say that as an opening statement or not, I'm not sure if I'm being honest. Being very precise at every moment comes with tradeoffs. It can be beneficial to say a potentially imprecise statement if it introduces the listener to the ideas quicker. I think this is especially important when trying to explain how things work from the high-level. Doing the bottom-up approach would be more precise for sure, but most people (including myself) find it harder to grasp concepts that way.
      I'm curious to hear if you have a suggestion on what would be a better statement at that point in the video; that would be appreciated!
      [1] While git stores snapshots of some form, some people may argue that it's not complete because it won't copy the files that haven't changed. For example, the files that remained unchanged would be stored as a reference, but does that matter? The devil is in the details, so it all depends on the intent.

  • @PierreLeroy76620
    @PierreLeroy76620 8 หลายเดือนก่อน

    I'm not a dev at all but I like git sadly it I didn not find any git GUI (cause cmd line are not my strong point) that could be use for binary files (my work field) If someone has that in mind please share 😅

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Have you tried git-lfs.com/ ?
      I've used it for non-human-readable files and it works fine.
      This should work with any git GUI: git-scm.com/downloads/guis

  • @soroushmoosapour8125
    @soroushmoosapour8125 9 หลายเดือนก่อน

    great video. From a content creator to another:
    1- keep Up the good work
    2- Buy a better Mic (Doesn't Have to be pricy : Blue yeti is a great chocie)
    3- use less voice normalization and comperesion.

    • @TechWithNikola
      @TechWithNikola  9 หลายเดือนก่อน +1

      Thanks. I’ll see what I can do. FWIW, I already use the Blue Yeti X.

    • @soroushmoosapour8125
      @soroushmoosapour8125 9 หลายเดือนก่อน

      Great! So the problem lies within the configuration of the effects you use and how you handling them.@@TechWithNikola

  • @sebbes333
    @sebbes333 9 หลายเดือนก่อน +5

    Play at 1.5x speed for a better experience.

  • @TimwiTerby
    @TimwiTerby 8 หลายเดือนก่อน

    The second half is just a standard git tutorial and doesn’t fit in with the title of the video. The title suggested a full explanation of git’s internals; however, you’ve only covered the object store. You’ve left out the stage index, stashes, and the diffing applied internally to save space.

    • @TechWithNikola
      @TechWithNikola  8 หลายเดือนก่อน

      Thank you for the comment. I don’t agree that the second part is “just a standard tutorial that doesn’t fit in”. How to generalize cherry-picks via merge is not something that is covered by standard tutorials.
      I agree that there are more topics that can be covered, such as the ones you’ve mentioned but also a lot more. There’s a tradeoff between having a very long and comprehensive video that covers all the details, and the one that covers core concepts but is easier to consume.
      Staging index and stashes, while important, are secondary features IMO. I agree that they can be covered but I don’t think that all topics have to be done in a single video. Diffing applied internally to save space is interesting on its own, but I don’t think it’s relevant enough to be in the same video as the object store. With that said, I would like to have a sequel to this video that covers other important details, such as how git syncs data over the network, etc.
      In any case, this is my view, which may be wrong, so I appreciate the feedback. Thank you for taking the time to leave the comment.