Understanding Git Basics and More

I've been coming across a lot of terms like amend, rebase, squash, etc., that I'm curious to learn more about. Until two days ago, I didn't even know it was possible to check out specific commits. Recently, I’ve started using Neovim and working with Git through lazygit.

Now, out of curiosity, I’ve set out to learn all these things.

I’m following The Primeagen’s Git tutorial from Boot.dev.

Repositories

I knew about the existence of the .git directory, but I never actually looked into it. I’ve always been curious to explore things, but somehow, I never thought to touch that folder. Everything we do with branches, commits, and other version control operations—why did I never think to open that folder or even Google it?

Obviously, in git add ., the . adds all the files in the current directory to the staging area.

And here’s something I found quite amazing: A commit is a snapshot of the repository at a specific point in time. It’s a way to save the state of the project, and it’s how Git keeps track of changes. Until now, I subconsciously thought that Git just stored changes per commit. But actually, it stores the complete files for each commit, although it optimizes the storage process internally.

Internals

I’ve noticed the long alphanumeric IDs of commits, but I didn’t know they were called commit hashes.