Aider AI Pair Programming Tutorial: Terminal Coding With Git Integration

Aider is free, open-source AI pair programming in your terminal: it edits code in your git repo, commits each change, and works with almost any LLM.

By Galactic News Editorial · Published 2026-11-27T02:13:44+00:00 · Updated 2026-11-27T02:13:44+00:00

Aider AI pair programming tutorial: terminal coding with git integration

Aider AI Pair Programming Tutorial: Terminal Coding With Git Integration

Aider is an open-source tool that lets you pair program with a large language model from your terminal, directly inside your own git repository. You describe a change in plain language. Aider edits your files, then commits the change with a sensible message. You review it with familiar git tools. There is no editor plugin to install and no chat window to copy code from. The terminal is the interface, and git is the safety net.

This explainer covers what Aider does, how to start, the daily workflow, and where it fits next to tools such as Copilot and Cursor.

What Aider Is

Aider is a command-line tool that pairs you with an LLM to edit code stored in your local git repository. It works with a new project or an existing repo. It supports most popular languages, including Python, JavaScript, TypeScript, Rust, Ruby, Go, C++, PHP, HTML, and CSS.

Three ideas define it. First, it works on your real codebase, not on pasted snippets. Second, every change is a git commit, so the full history of what the model did is visible and reversible. Third, it connects to almost any LLM, so you choose the model behind each session.

Aider works best with strong coding models. Its own site lists Claude 3.7 Sonnet, DeepSeek R1 and Chat V3, OpenAI o1, o3-mini, and GPT-4o among the recommended options. It can also connect to local models, and it works with LLM APIs as well as web chat interfaces, streamlining the copy and paste between browser and terminal.

Aider is free and open source under the Apache-2.0 licence. The only cost is whatever your chosen model provider charges for API calls.

Aider AI Pair Programming Tutorial: Getting Started

Setup takes a few minutes. The steps below use the standard install from the Python package index.

  1. Install Aider. Run python -m pip install aider-chat. An installer command, aider-install, is also available from the project site.
  2. Set your API key. For Claude, export ANTHROPIC_API_KEY. For OpenAI, export OPENAI_API_KEY. Aider reads the key from the environment, so it is never typed into the chat.
  3. Move into your repo. Change directory into a git repository, new or existing. Aider works with the files git tracks.
  4. Start Aider. Run aider with no arguments to open a chat session, or pass files directly, such as aider app.py tests/test_app.py.
  5. Choose a model if needed. Pass a model flag such as --model sonnet for Claude, --model deepseek for DeepSeek, or --model o3-mini for OpenAI's reasoning model.

That is the whole setup. No account, no editor configuration, and no project file. If the repo has no git history yet, initialise one first, because git is how Aider records its work.

The Daily Workflow: Add, Ask, Review, Commit

A session follows a short loop:

  1. Add files to the chat. Use /add <file> to bring files into the conversation. Aider edits only the files in the chat, so you control exactly what it can touch.
  2. Describe the change. Ask in plain language: fix the bug, add the feature, refactor the function. Be specific about the behaviour you want.
  3. Watch the edit. Aider proposes the change, applies it to your files, and commits it with a generated message. It can run your linter and test suite after each edit and try to fix problems it finds.
  4. Review with git. Run git diff to see what changed, or use Aider's own /diff command inside the session. If the change is wrong, /undo rolls back the last commit.
  5. Keep going or stop. Add more files, ask for the next change, or exit. The chat history is saved, so a later session can pick up where this one ended.

The discipline that makes this work is small steps. One change per request, reviewed before the next. A session that asks for five features at once produces a commit that is hard to review and harder to undo.

The Repo Map: Why Aider Handles Big Codebases

Most AI coding tools see only the files you have open. Aider builds a map of your entire git repository and sends it to the model with every request. The map is a compact summary of the most important classes, functions, and signatures across the codebase.

This matters for larger projects. When you ask for a change in one file, the model can see which other files call the function you are changing, what the interfaces look like, and where the change ripples. That is why Aider is often recommended for work on pre-existing, larger codebases rather than only for starting new files from scratch.

You can sharpen the map further. Aider supports custom context files, so a document describing your architecture can travel with the repo and inform every session. Voice input is also available for describing changes out loud, and you can add images and web pages to the chat for visual context such as screenshots or reference docs.

Aider vs Copilot and Cursor

AiderGitHub CopilotCursor
InterfaceTerminal chatEditor completions and chatEditor with agent mode
Codebase contextFull repo mapOpen files and nearby codeCurrent file plus indexed context
Change trackingAutomatic git commitsEdits in the editor, uncommittedEdits in the editor, uncommitted
Model choiceAlmost any LLM, including local modelsModels chosen by GitHubSeveral hosted models
CostFree; pay your model providerSubscriptionSubscription
Best forTerminal workflows and git-native reviewInline suggestions while typingEditor-centred agent work

The choice is about workflow, not quality. Developers who live in the terminal and want every change as a traceable commit tend to prefer Aider. Developers who want suggestions as they type tend to prefer Copilot. Many use both: Copilot for completions, Aider for larger refactors.

Limits and Safety Habits

Aider has real limits, and the habits below keep them from biting:

Bottom Line

Aider is the most direct way to pair program with an LLM if you live in the terminal. Install it, set an API key, add the files you want to change, and describe the work. The repo map gives the model real context, automatic git commits give you a reviewable history, and /undo gives you a way back. Start with small changes, review every diff, and keep secrets out of the chat.