惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
博客园 - 【当耐特】
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
MyScale Blog
MyScale Blog
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
I
InfoQ
B
Blog RSS Feed
腾讯CDC
云风的 BLOG
云风的 BLOG
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
雷峰网
雷峰网
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
D
DataBreaches.Net
The Cloudflare Blog
V
V2EX
S
SegmentFault 最新的问题

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
The Git Workflow Every Solo Developer Needs (2026)
Alex Chen · 2026-05-16 · via DEV Community

Alex Chen

The Git Workflow Every Solo Developer Needs (2026)

Stop committing directly to main. This system prevents 90% of "oh crap" moments.

The Problem

We've all done it:

# Quick fix, no time for branches
git add -A
git commit -m "fixed bug"
git push origin main

# ... 2 hours later ...
# Oh no, that broke something else

Enter fullscreen mode Exit fullscreen mode

When you're solo, there's no code review partner. You need your own process to be your safety net.

My Workflow

Branch Strategy

main (protected — never push directly)
  ├── feature/xxx     (new features)
  ├── fix/xxx         (bug fixes)
  └── refactor/xxx    (code cleanup)

Enter fullscreen mode Exit fullscreen mode

Pre-Push Hook (My #1 Safety Net)

#!/bin/sh
# .git/hooks/pre-push — runs before every push

# 1. Block direct pushes to main/develop
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH" = "main" ] || [ "$BRANCH" = "master" ]; then
  echo "❌ Direct pushes to '$BRANCH' are blocked!"
  echo "   Create a feature branch and merge instead."
  exit 1
fi

# 2. Check for secrets
if git diff --cached --name-only | grep -qiE '\.env$|credentials|secret'; then
  echo "⚠️  Possible secret file detected!"
  exit 1
fi

# 3. Run tests if available
if [ -f "package.json" ] && grep -q '"test"' package.json; then
  npm test || { echo "❌ Tests failed"; exit 1; }
fi

echo "✅ All checks passed"
exit 0

Enter fullscreen mode Exit fullscreen mode

Make executable: chmod +x .git/hooks/pre-push

Useful Aliases

# ~/.gitconfig
[alias]
  s = status -sb
  lg = log --oneline --graph --decorate
  undo = reset --soft HEAD~1
  amend = commit --amend --no-edit
  save = stash push -u -m 'WIP'
  pop = stash pop
  clean-branches = "!git branch --merged | grep -v '\\*\\|main\\|master' | xargs git branch -d"

Enter fullscreen mode Exit fullscreen mode

Handling Mistakes

"I pushed broken code to main"

# Option 1: Revert (safe, preserves history)
git revert HEAD
git push origin main

# Option 2: If you MUST rewrite history
git reset --hard HEAD~1
git push --force-with-lease origin main

Enter fullscreen mode Exit fullscreen mode

"I committed to the wrong branch"

git branch new-branch
git reset --hard HEAD~N  # N = number of commits to move back
git checkout new-branch   # Your work is here now

Enter fullscreen mode Exit fullscreen mode

Release Workflow

npm version patch/minor/major  # Updates package.json, creates tag
git push --follow-tags        # Pushes commits and tags
npm publish                   # Publishes to registry

Enter fullscreen mode Exit fullscreen mode


Follow @armorbreak for more developer productivity tips.