#Git is the only honest history we have. It is a directed acyclic graph of your failures and occasional brilliance. Most people treat it like a glorified Dropbox or a corporate compliance tool, but Linus Torvalds built this to escape centralised nonsense. He built it to manage the Linux kernel without asking permission.
Here is my proper way to use it. No bloat. No mouse clicks. The Basics:
1. git init
This starts the universe. It creates the hidden .git directory which contains the actual database.
2. git status
Run this constantly. It is your eyes. It tells you what is staged and what is untracked. If you don't look at the status, you are coding blind.
3. git add -p
Stop using git add . like a lazy amateur. The -p flag lets you review changes hunk by hunk. It forces you to actually look at the rubbish you wrote before you stage it.
4. git commit -m "$(now) -- message"
I define a now() function in my shell. Most of the time I just timestamp the snapshot. It is faster than agonizing over poetry for a minor config tweak.
5. git switch -c
The old checkout command was overloaded and confusing. Use switch to handle branches. It is cleaner.
The "Oh God" Toolkit:
6. git reflog
This is the flight recorder. Every time HEAD moves, it is recorded here. If you accidentally delete a branch or hard reset into oblivion, reflog has the SHA hash you need to get back to reality. It saved my nvim config just last week.
7. git reset --hard
The nuclear option. It forces your files to match the repo state exactly. Useful when you have made a mess of the working directory and just want to scrub it clean.
For my Arch Bros:
Stop installing bloatware like GNU Stow to manage your dotfiles. You don't need extra dependencies. Use a bare repository.
1. git init --bare $HOME/.cfg
2. alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
3. config config --local status.showUntrackedFiles no
Now you can version control your .zshrc and .xinitrc from right where they sit.
Philosophy:
- git rebase -i
Don't pollute the history with "wip" and "typo" commits. Squash them. Keep your history linear. A messy log is a sign of a messy mind.
- git push
Ideally, you are pushing this to a VPS you control, not just feeding Microsoft's data silo at GitHub. Own your code.
Back on nostr. Lost my sec-key
#introductions