Git¶
"Version control is not just a tool, it's a habit."
Git is a distributed version control system for tracking changes in files, coordinating work across multiple developers, and reverting to any point in history. GitHub extends that with remote hosting, collaboration, and workflow automation.
This section is a living reference, not a tutorial. Every entry here came from a real situation: a merge gone wrong, a stale creation date, a pushed commit that shouldn't have been, a branch tracking the wrong remote. If it happened, it's here.
What's Inside¶
The commands you run every day: init, add, commit, status, .gitignore, aliases, and commit message conventions.
Branching strategies, stash workflows, reverting commits, resetting history, and inspecting specific commits.
Push, pull, SSH setup, fork workflows, multiple Git identities, divergent branches, and Git LFS.
Quick Reference¶
The commands you reach for daily, no need to open a full article:
git status # what's going on
git add . # stage everything
git commit -m "feat: add thing" # commit with message
git push # push to remote
git pull --rebase # pull and keep history linear
git stash push -m "wip/my-work" # stash with a name
git stash pop # apply and drop latest stash
git stash list # see all stashes
git log --oneline -10 # last 10 commits at a glance
git diff # unstaged changes
git restore --staged . # unstage everything
git switch -c feat/my-feature # create and switch to new branch
git merge <branch> # merge branch into current
git branch -D <branch> # delete local branch
Resources¶
- Official Git Documentation
- Conventional Commits Spec
- gitignore patterns
- Ignoring files — GitHub Docs
- Git LFS
- Revert a pushed commit
- Fix non-fast-forward push errors