Advanced git

Bonus Block: git Internals

Jan Simson

Anatomy of a Repository

The Anatomy of a git Repository πŸ«€

Inside .git/.

  • objects/: Actual data / contents
  • refs/: Points to commits (e.g. branches, tags)
  • logs/: History for reflog
  • HEAD: Points to the current HEAD e.g. a branch or commit
  • config: Repository-specific configuration settings
  • index: Staging area

Let’s look at it in practice! πŸ‘€

Demo: Looking inside .git/ (including index/staging).

Warning

Messing with a git repository has a high chance of ruining it. Only do this with repositories that you have plenty of backups of or ones that are not important.

# Helper to decompress binary files
alias deflate="perl -MCompress::Zlib -e 'undef $/; print uncompress(<>)'"

Practical: Look inside! πŸ‘€

  1. Look inside the .git folder of your cookbook repository.
  2. Stage files and look at the index changing (in size)
  3. Make a new commit and see whether you can notice some changes

More Info & Sources

End of Block πŸŽ‰

Any Questions?

[🏑 Back to Overview]