DEV Community

Kilnbright
Kilnbright

Posted on Edited on AI-assisted

Git for solo developers: the 8 commands I actually use

If you work alone, Git can feel like overkill. It isn't. It is the undo button for your whole project. You do not need 100 commands. These eight cover almost everything I do day to day.

1. Start tracking

git init
git add .
git commit -m "first commit"
Enter fullscreen mode Exit fullscreen mode

2. See what changed

git status
git diff
Enter fullscreen mode Exit fullscreen mode

Run git status constantly. It tells you what Git thinks is going on, and it is the fastest way to stop being confused.

3. Save a snapshot

git add -p
git commit -m "Fix crash when the config file is missing"
Enter fullscreen mode Exit fullscreen mode

git add -p lets you stage piece by piece, so each commit is one idea. Small commits are easy to undo.

4. Branch before you experiment

git switch -c try-new-parser
Enter fullscreen mode Exit fullscreen mode

If it goes badly, switch back and delete the branch. Nothing on main was touched.

5. Merge when it works

git switch main
git merge try-new-parser
Enter fullscreen mode Exit fullscreen mode

6. Undo a mistake

git restore file.py          # throw away uncommitted edits to one file
git revert abc1234           # undo a commit safely, with a new commit
Enter fullscreen mode Exit fullscreen mode

7. Find out when something broke

git log --oneline
git bisect start
Enter fullscreen mode Exit fullscreen mode

git bisect does a binary search through your history to find the commit that introduced a bug. It feels like a cheat code the first time.

8. Back it up

git remote add origin <your-repo-url>
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

A push is your off-site backup. Do it at the end of every work session.

The habit that matters

Commit small, commit often, branch before anything risky, push at the end of the day. That is 90% of Git for a solo developer.


Disclosure: I wrote a short, AI-assisted beginner ebook that goes through this in about an hour, with exercises: Git for Solo Developers ($5). There is also a Git bundle ($9). Everything in this post is free to use without it.

Top comments (0)