How to use Aider to pair program in your terminal with git undo

Aider is a terminal pair programmer: it maps your repo, edits files, and commits each change to git so you can undo anything. Here is how to get it running against your own codebase, based on the Aider README, and how to keep its edits safe.

Install

python -m pip install aider-install
aider-install

Then go to your project and start it with a model of your choice. The README shows these three:

cd /to/your/project

# DeepSeek
aider --model deepseek --api-key deepseek=<key>

# Claude 3.7 Sonnet
aider --model sonnet --api-key anthropic=<key>

# o3-mini
aider --model o3-mini --api-key openai=<key>

Aider works with most hosted models and local ones too, so pick whatever you already pay for.

Why the repo map matters

Aider builds a map of your whole codebase and sends the relevant part with each request. That is what lets it work on larger projects instead of only single files. You add the files you want edited to the chat, and the map gives the model context on everything around them.

Git as your safety net

Every change Aider makes is committed with a sensible message. That gives you a simple loop:

  1. Ask for one small change.
  2. Look at the commit with git diff HEAD~1 or your usual git tool.
  3. Keep it, or run git reset --hard HEAD~1 (or Aider’s /undo) to drop it.

Work on a branch, and commit your own changes first so Aider’s commits stay separate from yours.

Let tests and linters check its work

Aider can lint and test after each edit and try to fix what fails. Point it at your test command so a bad edit is caught before you read the diff. Review the flags in the README’s lint and test docs, since the exact options depend on your stack.

Other ways to drive it

  • Add a comment in your editor and let Aider pick it up (IDE watch mode).
  • Add screenshots or web pages to the chat for visual context.
  • Speak requests with voice-to-code.
  • Copy and paste to a web chat if you only have a browser subscription.

Things to check

  • You pay your model provider for every request, so watch token use on large repos.
  • Never paste real API keys into shared shell history or commit them.
  • Review diffs on anything touching auth, payments or infrastructure.

More on Deduped

Aider sits in a crowded category. See the best AI repos for coding agents and, if you want to run several agents at once, best AI repos for running multiple coding agents.

Want the setup commands for 50 AI repos people actually ship with? Get the free AI Repos That Actually Ship pack: https://dedupedai.com/ship-pack/?utm_source=devto&utm_medium=article&utm_campaign=shippack

Leave a Reply