TechOps Examples

Hey — It's Govardhana MK 👋

Welcome to another technical edition.

Every Tuesday – You’ll receive a free edition with a byte-size use case, remote job opportunities, top news, tools, and articles.

Every Thursday and Saturday – You’ll receive a special edition with a deep dive use case, remote job opportunities and articles.

Top engineers at Anthropic and OpenAI say AI now writes 100% of their code.

If you're not using AI, you're spending 40 hours doing what they do in 4.

These 100+ Claude Code hacks fix that and help you ship 10x faster.

Sign up for The Code and get:

🛠 TOOL OF THE DAY

terraform module releaser - GitHub Action to automate versioning, releases, and documentation for Terraform modules in monorepos.

🧠 USE CASE

What Is Inside the .git Folder?

We rarely look inside the .git directory, but understanding its structure can help in debugging, recovering lost work, and even optimizing Git performance.

This hidden directory keeps track of everything - commits, branches, history, and configurations, allowing Git to function efficiently.

Here I’ve broken it down into a simple and self explanatory form:

Download a high resolution pdf of this diagram here for future reference.

Let’s go beyond just listing files and dive into why they matter.

1. Objects – The Core of Git’s History

Git stores everything - commits, trees (directories), and blobs (files) as objects in .git/objects/.

These are immutable and referenced by SHA-1 hashes.

  • If you accidentally delete a branch, Git might still have its commits in objects/. Running git fsck --lost-found can help recover them.

  • Git optimizes storage using packfiles (pack-xxxx.pack) to compress and store multiple objects efficiently. Large repos rely on this for performance.

2. Refs – The Named Pointers to Your Work

The .git/refs/ folder keeps track of branches, tags, and remote repositories.

  • refs/heads/main holds the latest commit hash of the main branch.

  • refs/tags/v1.0 points to a specific commit for a tagged release.

  • refs/remotes/origin/main helps Git know what the main branch looked like on the remote last time you fetched.

Deleting a branch only removes its reference from refs/heads/, but the commits might still exist in objects/ until garbage collection runs.

3. Logs – Your Hidden Undo Button

The .git/logs/ directory maintains a history of HEAD movements. Every checkout, commit, and rebase updates these logs.

  • Lost a commit? Run git reflog to find the last known SHA and recover it with git reset --hard <SHA>.

  • These logs are temporary and will be deleted when Git runs garbage collection (git gc).

4. Config – Tuning Git for Performance and Security

The .git/config file controls repository settings, including remotes, aliases, and hooks.

  • If your remote origin URL is incorrect, fix it with git remote set-url origin <new-url>.

  • Want faster fetch operations? Enable git config core.sparseCheckout true to fetch only specific folders.

5. Index and Staging Area – Where Changes Live Before Commit

The .git/index file is the staging area. When you run git add, changes go here before being committed.

  • If a commit is missing expected changes, check if they were staged with git diff --cached.

  • Running git reset modifies the index without touching working files.

If you’ve never explored .git/ before, try running ls -lah .git and start experimenting with git cat-file -p to inspect objects directly.

You might just uncover something that changes the way you use Git forever.

I run a DevOps and Cloud consulting agency and have helped 17+ businesses, including Stanford, Hearst Corporation, CloudTruth, and more.

When your business needs my services, book a free 1:1 business consultation.

You may even like:

Looking to promote your company, product, service, or event to 40,000+ Cloud Native Professionals? Let's work together.

Keep Reading