Hook

Their other posts in the index, biggest breakout first.
git init. Here's the command most developers run on day one without ever asking what it actually does. Git init creates a hidden folder called .git inside your project, and that single hidden folder is the entire repository, not the files you can see, the hidden one sitting quietly underneath everything. Delete that folder and Git forgets your project ever existed, even though every file is still sitting right there, completely untouched. Git clone. Here's something that surprises almost everyone the first time they understand it properly. Git clone does not just copy the current state of a project, it downloads every commit, every branch, every version that has ever existed since the very first day someone created that repository. You are not downloading a snapshot, you are downloading an entire timeline all at once, which is exactly why cloning a massive project can sometimes take longer than expected. Git add. This next part confuses nearly every beginner and almost nobody explains it clearly. Making changes to a file does not mean Git is tracking it yet. Git add moves your edits into something called the staging area, a waiting room before anything becomes permanent. This exists for one reason: control. You can edit ten different files but you choose to stage only three, building a commit with exactly what you intended, with nothing extra sneaking in by accident. Git commit. This is the actual save point, the moment your staged changes become a permanent snapshot with a message explaining why they exist. Once committed, that snapshot never disappears from history, even if you delete the file the very next day, the snapshot is still right there. Good developers write messages future teammates can actually understand. Bad ones write fixed stuff and then genuinely forget what they fixed within three days. Git push. Your commits exist only on your machine until this next step sends them somewhere else, usually GitHub or a private company server. Without pushing, your work stays invisible to everyone but you. This is the step new developers forget constantly. They commit perfectly, feel accomplished, close their laptop, and their teammates see nothing changed because nothing actually left their machine. Git pull. Here's the reverse side of that same problem, pulling down changes your teammates already pushed and merging them into your local files automatically. Skip this before starting new work and you risk building on outdated code while everyone else has already moved three steps ahead without you. This one habit alone prevents more conflicts than almost any other practice in collaborative development. Git branch. Stay with this next one because it explains how five developers can touch the exact same project without destroying each other's work. How? Branches let you experiment without breaking anything that already works. Creating a branch is essentially cloning your current code into a parallel universe. You can break things, test wild ideas, completely fail, and the original main branch never even notices anything happened. Git merge. Eventually, separate branches need to become one again, and this is how that actually happens. Git automatically combines changes from two branches into one, usually silently, often without you noticing it at all. But when two people edit the exact same line differently, Git stops and forces you to resolve it manually. You decide. That moment is called a merge conflict, the single most feared phrase in every developer's daily vocabulary. Git revert. Mistakes happen. Code breaks production, and this next command is how you undo a commit without erasing it from history forever. Instead of deleting the bad commit like it never existed, Git revert creates a brand new commit that cancels out exactly what the previous one did. This keeps your history honest. Anyone looking back later can see the mistake happened and precisely how it got fixed afterward. Nothing hidden, everything readable. Git stash. And here's the command that saves you the one time you genuinely need it most. Mid feature, half your files are a complete mess, and suddenly you need to switch branches immediately for an urgent fix. Git stash temporarily hides all your uncommitted changes without committing anything broken, leaving a clean working directory in seconds. Switch branches, fix the problem, switch back, run stash pop, and every change you were working on reappears exactly where you left it.