Git Commands
Complete Git reference — from basic setup to advanced workflows. Commands, options, and real-world examples.
📖 Git: Mastering the Threads of Time
We've all faced that moment of pure dread: 'It worked yesterday, why is it broken today?' or worse, 'I just deleted or overwrote my most important file!' I remember my early days of coding when a single wrong copy-paste could ruin a whole week's work. Git was built to be more than just a backup; it's the digital safety net that allows us to experiment, collaborate, and even 'time travel' back to when things were right.
KitPunch’s Git Cheat Sheet is designed for those moments when you can't remember the exact syntax or you're stuck in a complex merge. From the absolute basics to the 'advanced magic' of Rebase and Reflog, we've organized the commands so you can find your way out of the labyrinth. A clean commit history is a gift to your future self and your teammates. Don't fear the branch — embrace it.
🚀 Navigating the Git Cheat Sheet
- Select a category (Setup, Basic, Branching, etc.) to see relevant commands.
- Use the search bar to find specific git keywords like 'undo', 'reset', or 'log'.
- Check the Common Workflows section to see how commands work together in real-world scenarios.
- Click any command to copy it, ready to paste directly into your terminal.
💡 The Art of the Atomic Commit
Aim to commit small and often. Each commit should represent a single 'atom' of work—a single feature, a single bug fix, or a single refactor. This makes it much easier to track down where a bug was introduced and gives you a much finer level of control if you ever need to revert a change.
❓ Frequently Asked Questions
Merge creates a new commit that ties two branches together, preserving the full, messy history. Rebase 'replays' your work on top of the target branch, creating a clean, linear story. Use Merge for shared team branches and Rebase for cleaning up your local feature branch before merging.
Use `git commit --amend -m 'your new message'`. This will replace the last commit with a new one containing the corrected message. Only do this for commits that haven't been pushed to a shared repository yet!