aider/website/docs/git.md
Aider works best with code that is part of a git repo. Aider is tightly integrated with git, which makes it easy to:
/undo command to instantly undo any AI changes that you don't like.Aider uses git in these ways:
Aider also allows you to use in-chat commands to perform git operations:
/diff will show all the file changes since the last message you sent./undo will undo and discard the last change./commit to commit all dirty changes with a sensible commit message./git will let you run raw git commands to do more complex management of your git history.You can also manage your git history outside of aider with your preferred git tools.
While it is not recommended, you can disable aider's use of git in a few ways:
--no-auto-commits will stop aider from git committing each of its changes.--no-dirty-commits will stop aider from committing dirty files before applying its edits.--no-git will completely stop aider from using git on your files. You should ensure you are keeping sensible backups of the files you are working with.--git-commit-verify will run pre-commit hooks when making git commits. By default, aider skips pre-commit hooks by using the --no-verify flag (--git-commit-verify=False).Aider sends the --weak-model a copy of the diffs and the chat history
and asks it to produce a commit message.
By default, aider creates commit messages which follow
Conventional Commits.
You can customize the
commit prompt
with the --commit-prompt option.
You can place that on the command line, or
configure it via a config file or environment variables.
Aider marks commits that it either authored or committed.
You can use --no-attribute-author and --no-attribute-committer to disable
modification of the git author and committer name fields.
Additionally, you can use the following options to prefix commit messages:
--attribute-commit-message-author: Prefix commit messages with 'aider: ' if aider authored the changes.--attribute-commit-message-committer: Prefix all commit messages with 'aider: ', regardless of whether aider authored the changes or not.Finally, you can use --attribute-co-authored-by to have aider append a Co-authored-by trailer to the end of the commit string.
This will disable appending (aider) to the git author and git committer unless you have explicitly enabled those settings.