Usage
How to use aider to pair program with AI and edit code in your local git repo.
Run aider
with the source code files you want to edit. These files will be "added to the chat session", so that aider can see their contents and edit them for you. They can be existing files or the name of files you want aider to create for you.
At the aider >
prompt, ask for code changes and aider will edit those files to accomplish your request.
Adding files
To edit files, you need to "add them to the chat". Do this by naming them on the aider command line. Or, you can use the in-chat /add
command to add files.
Only add the files that need to be edited for your task. Don't add a bunch of extra files. If you add too many files, the LLM can get overwhelmed and confused (and it costs more tokens). Aider will automatically pull in content from related files so that it can understand the rest of your code base.
You can use aider without adding any files, and it will try to figure out which files need to be edited based on your requests.
{: .tip } You'll get the best results if you think about which files need to be edited. Add just those files to the chat. Aider will include relevant context from the rest of your repo.
LLMs
Or you can run aider --model XXX
to launch aider with another model. During your chat you can switch models with the in-chat /model
command.
Making changes
Ask aider to make changes to your code. It will show you some diffs of the changes it is making to complete you request. Aider will git commit all of its changes, so they are easy to track and undo.
You can always use the /undo
command to undo AI changes that you don't like.
Last updated