AI Starter Package
4 of 8 · 30 min

Git and GitHub Integration

Why Git Matters for AI Development

When an AI agent edits your code, version control is your safety net. Every change Claude makes can be reviewed, reverted, or refined. Git turns AI-assisted development from risky into reliable. If Claude breaks something, you are one git checkout away from recovery.

Committing with Claude

Instead of writing commit messages yourself, let Claude do it:

"Look at the current changes and create a commit with a descriptive message."

Claude reads the diff, understands the intent, and writes a commit message that explains why the change was made — not just what changed. It follows conventional commit formats automatically when your project uses them.

Branching Strategies

Always work on feature branches when using Claude Code for larger changes:

  • Feature branches: "Create a new branch called feat/add-search and implement full-text search."
  • Naming conventions: Use prefixes like feat/, fix/, refactor/ to keep branches organized.
  • Isolation: Each feature gets its own branch. If Claude goes off track, only that branch is affected.

Creating Pull Requests

Claude Code integrates with the gh CLI to create pull requests directly from your terminal:

"Push this branch and create a pull request with a summary of all the changes."

Claude writes the PR title, description, and test plan. It summarizes every commit on the branch so reviewers understand the full scope of changes.

Code Review with Claude

Use Claude to review your own code before others see it:

"Review the diff on this branch for bugs, security issues, and missing edge cases."

Claude catches issues humans miss: unhandled null values, SQL injection risks, missing error boundaries, and inconsistent naming. Run this before every PR.

Handling Merge Conflicts

When branches diverge, conflicts are inevitable. Claude handles them naturally:

"Merge main into this branch and resolve any conflicts. Keep our feature changes but adopt the latest API signatures from main."

Give Claude clear instructions on which changes to prioritize. It reads both versions, understands the intent, and produces a clean merge.

Practice Exercise

Try this workflow on your current project right now:

  • Create a new branch: "Create a branch called feat/practice and switch to it."
  • Make a small change: "Add a comment to the top of the main file explaining what it does."
  • Commit it: "Commit this change with a descriptive message."
  • Review it: "Show me the diff between this branch and main."

This four-step cycle — branch, change, commit, review — is the foundation of professional AI-assisted development.

Ready for more?

You now have the foundations: installation, tools, prompting, and Git. The next four lessons cover CLAUDE.md configuration, multi-file workflows, debugging strategies, and building complete systems. Continue the course or explore the full AI Brain system.