Why Git?
Git tracks every change you make and backs up your data.
- Revert mistakes - Messed something up? Roll back any file to any previous version.
- Cloud backup - Push to GitHub to back up versions of your repository.
- See what changed -
/pushwrites a commit message for you. Months later you can look back and see how your system evolved.
Ask Claude: “Show me what changed this week.” “Restore tasks.md to yesterday.” “Push my changes.”
With git history, /weekly can compare what you planned vs what you did.
If your workspace is in iCloud, Dropbox, or OneDrive - move it to a regular folder first. Git + cloud backups (with exception of Obsidian Sync) do not play nice.
Setup
Install Git (this may take ~5-10 minutes)
# If you have Homebrew:
brew install git
# If you don't have Homebrew, install it first:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Then run: brew install gitInitialize Your Repository
cd ~/Documents/claude-workspace
git init
git add .
git commit -m "Initial setup"Test It Works
In Claude Code:
This creates a commit with a message based on your changes so you (and Claude) can track things over time.
Optional: Connect to GitHub (enables sync with the cloud)
Step 1: Install GitHub CLI
brew install ghStep 2: Authenticate
This opens your browser. Click “Authorize” and you’re done. No tokens to copy.
Step 3: Create a private repo and connect it
This creates a private GitHub repo and pushes your current folder to it in one command.
Now /push syncs to the cloud. I typically push once a week before my weekly review.
Your workspace may contain personal notes, network info, or other sensitive context. Keep it private unless you have a reason to share.
Security: What Should Never Go in Text Files
Never put in version controlled files:
- API keys (other than .env that’s listed in .gitignore)
- Passwords
- Credit cards
- SSNs
- Private keys
Instead:
- Use environment variables
- Keep sensitive data elsewhere (e.g. 1Password)
- Create a .gitignore file and list files that you don’t want backed up
Checkpoint
You should now have:
- Git installed and initialized
/pushworking to create commits- Optionally connected to GitHub for cloud backup
Understanding:
- Git gives you version history and the ability to revert mistakes
- Don’t mix Git with iCloud/Dropbox/OneDrive