Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Oh yeah, the Git internals... I tried to find my way through them using visualization but did not progress much: https://github.com/smartmic/git2pic


I encourage everyone to read A Plumber's Guide to Git: https://alexwlchan.net/a-plumbers-guide-to-git/

It's not a book, just a series of five short blog posts. Part 1 explains precisely where files live: https://alexwlchan.net/a-plumbers-guide-to-git/1-the-git-obj...

  $ mkdir animals

  $ cd animals

  $ git init

  $ echo "Big blue basilisks bawl in the basement" > animals.txt
  
  $ git hash-object -w animals.txt
  b13311e04762c322493e8562e6ce145a899ce570
  
  $ find .git/objects -type f
  .git/objects/b1/3311e04762c322493e8562e6ce145a899ce570

  $ rm animals.txt

  $ git cat-file -p b13311e04762c322493e8562e6ce145a899ce570 > animals.txt
Congratulations, you just did a `git restore animals.txt` manually.

Parts 2 through 5 are equally illuminating.


Thank you a thousand times for sharing that. I just ran through the examples and they were very enlightening.



I found this page had very easy to understand visuals

https://www.devopsschool.com/blog/git-tutorial-objects-refer...


It is fun to explore the Git internals! Some time back, I used it to learn Golang [1]. Two birds with one stone!

[1] https://github.com/ssrathi/gogit



Let me add the You Tube series - Git and GitHub for Poets - for the poets, students and teachers. Not to everyone's taste but what is?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: