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 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.
- Install Aider. Run
python -m pip install aider-chat. An installer command,aider-install, is also available from the project site. - Set your API key. For Claude, export
ANTHROPIC_API_KEY. For OpenAI, exportOPENAI_API_KEY. Aider reads the key from the environment, so it is never typed into the chat. - Move into your repo. Change directory into a git repository, new or existing. Aider works with the files git tracks.
- Start Aider. Run
aiderwith no arguments to open a chat session, or pass files directly, such asaider app.py tests/test_app.py. - Choose a model if needed. Pass a model flag such as
--model sonnetfor Claude,--model deepseekfor DeepSeek, or--model o3-minifor 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:
- 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. - Describe the change. Ask in plain language: fix the bug, add the feature, refactor the function. Be specific about the behaviour you want.
- 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.
- Review with git. Run
git diffto see what changed, or use Aider's own/diffcommand inside the session. If the change is wrong,/undorolls back the last commit. - 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
| Aider | GitHub Copilot | Cursor | |
|---|---|---|---|
| Interface | Terminal chat | Editor completions and chat | Editor with agent mode |
| Codebase context | Full repo map | Open files and nearby code | Current file plus indexed context |
| Change tracking | Automatic git commits | Edits in the editor, uncommitted | Edits in the editor, uncommitted |
| Model choice | Almost any LLM, including local models | Models chosen by GitHub | Several hosted models |
| Cost | Free; pay your model provider | Subscription | Subscription |
| Best for | Terminal workflows and git-native review | Inline suggestions while typing | Editor-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:
- Review every commit. Auto-commit is a record, not an approval. Read the diff before pushing anything.
- Never commit secrets. Aider sends the files in the chat, the repo map, and the history to the model provider. Keep API keys, tokens, and credentials out of the repo and out of the chat.
- Run the tests. Aider can run your linter and tests after each edit. Turn that on, and treat a failing test as a reason to stop and inspect, not to ask for another fix blindly.
- Keep the chat small. Add only the files a change needs. A huge chat costs more tokens and gives the model more room to wander.
- Use the cheap model for easy edits. A small model handles typos and simple changes. Save the strong model for refactors and hard bugs.
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.