Git keeps a timeline of your project on your computer. GitHub keeps that timeline online, so it's safe and shareable. If you build with Claude or any AI, these few ideas save you from losing work.
github.com.git-scm.com, then check it with git --version.cli.github.com) and run gh auth login. Now Claude Code can push for you.Never commit passwords or API keys. Ask Claude to add a .gitignore and keep secrets in a .env file that isn't pushed.
| Idea | Command | Say to Claude |
|---|---|---|
| Commit A snapshot of every file, linked to the one before | git add -Agit commit -m "msg" | "Commit everything with a clear message" |
| Timeline / log Your app's history, commit by commit | git log --oneline | "Show me the last 10 commits in one line each" |
| Go back Undo changes by returning to a working commit | git revert <id> | "Go back to the last commit where the app worked, but don't delete history" |
| Push Upload your timeline to GitHub | git push | "Push my commits to GitHub" |
| Clone Download a repo with its whole timeline | git clone <url> | "Clone this repo and tell me how to run it" |
| Branch A second timeline to try something safely | git switch -c new-feature | "Create a branch called dark-mode and work there" |
| Merge Bring a working branch back into main | git switch maingit merge new-feature | "It works, merge dark-mode into main" |
| Delete branch Throw away an experiment | git branch -D new-feature | "That didn't work, delete the dark-mode branch and go back to main" |
| Tag Name a version you can return to | git tag v1git push --tags | "Tag this version as v1 and push the tag" |
git reset --hard also goes back, but it deletes the newer commits. Prefer revert unless you're sure.