Closed xavitg closed 1 week ago
You definitely haven't lost all the changes - they're all still in git. The changes are saved, and you'll be able to revert the steps with git. I can talk you through it probably if you'd like?
Paul: I think I've experienced this, and I'm not entirely sure why/what's going on - but I know that my repo is in a symbolic link? But also I note it could be releated to other things.
@xavitg : take a look here
Step 1 open a command line Step 2 type cd /home/soporte/BI-Improved/ Step 3
take a look here:
do git log
to check your git is working as expected
step 4 Revert the Last Commit (Discard the Changes most recently made - this won't work - if you've subsequently committed to the repository after stopping using aider)
git reset --hard HEAD~1
This command will move HEAD back by one commit and discard all the changes in that commit. (beware - if you've worked on this after using aider - it will change things AND you will lose your changes)
Thanks for trying aider and filing this issue.
It looks like you ran aider in a git repo with a detached head? Or you changed the working dir to a detached head while aider was running?
Thanks for trying aider and filing this issue.
The fix is available in the main branch. You can get it by installing the latest version from github:
aider --install-main-branch
# or...
python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git
If you have a chance to try it, let me know if it works better for you.
Issue
I use /undo and I get this error that closes my aider instance instantly:
image.png main.py platforms/facebook.py platforms/google_ads.py static/js/scripts.js templates/index.html
Traceback (most recent call last): File "/home/soporte/BI-Improved/venv/bin/aider", line 8, in
sys.exit(main())
^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/main.py", line 640, in main
coder.run()
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/coders/base_coder.py", line 770, in run
self.run_one(user_message, preproc)
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/coders/base_coder.py", line 805, in run_one
message = self.preproc_user_input(user_message)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/coders/base_coder.py", line 794, in preproc_user_input
return self.commands.run(inp)
^^^^^^^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/commands.py", line 204, in run
return self.do_run(matching_commands[0][1:], rest_inp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/commands.py", line 179, in do_run
return cmd_method(args)
^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/aider/commands.py", line 426, in cmd_undo
current_branch = self.coder.repo.repo.active_branch.name
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/git/repo/base.py", line 1036, in active_branch
return self.head.reference
^^^^^^^^^^^^^^^^^^^
File "/home/soporte/BI-Improved/venv/lib/python3.11/site-packages/git/refs/symbolic.py", line 413, in _get_reference
raise TypeError("%s is a detached symbolic reference as it points to %r" % (self, sha))
TypeError: HEAD is a detached symbolic reference as it points to 'b9815c231155df27ef1eee4bb01fdd7f6bbe5d3a'
(venv) soporte@ai:~/BI-Improved$
This is a serious problem because I lose all the changes and now I have to start again from 0 instead of using undo command to revert the wrong changes made by Claude.
Version and model info
Aider 0.50.1 Antrophic vertex ai claude 3.5 sonnet