This commit is contained in:
Paul Gauthier 2023-08-19 06:47:39 -07:00
parent ae8d04a95f
commit 66e04bde3d

View file

@ -10,27 +10,22 @@
## How does aider use git?
It is recommended that you use aider with code that is part of a git repo.
This allows aider to maintain the safety of your code. Using git makes it easy to:
Aider works best with code that is part of a git repo.
Aider is tightly integrated with git, which makes it easy to:
- Undo any changes that weren't appropriate
- Undo any GPT changes that you don't like
- Go back later to review the changes GPT made to your code
- Manage a series of GPT's changes on a git branch
Working without git means that GPT might drastically change your code
without an easy way to undo the changes.
Aider tries to provide safety using git in a few ways:
Aider specifically uses git in these ways:
- It asks to create a git repo if you launch it in a directory without one.
- Whenever GPT edits a file, those changes are committed with a descriptive commit message. This makes it easy to revert or review GPT's changes.
- If GPT tries to edit files that already have uncommitted changes (dirty files), aider will first commit those existing changes with a descriptive commit message. This makes sure you never lose your work if GPT makes an inappropriate change to uncommitted code.
- Whenever GPT edits a file, aider commits those changes with a descriptive commit message. This makes it easy to undo or review GPT's changes.
- Aider takes special care if GPT tries to edit files that already have uncommitted changes (dirty files). Aider will first commit any preexisting changes with a descriptive commit message. This makes sure you never lose your work if GPT makes an inappropriate change.
Aider also allows you to use in-chat commands to `/diff` or `/undo` the last change made by GPT.
To do more complex management of your git history, you cat use raw `git` commands,
either by using `/git` or with git tools outside of aider.
You can start a branch before using aider to make a sequence of changes.
Or you can `git reset` a longer series of aider changes that didn't pan out. Etc.
either by using `/git` within your chat, or with git tools outside of aider.
While it is not recommended, you can disable aider's use of git in a few ways: