Pycharm сбросить кэш проекта
Я пытаюсь полностью удалить и повторно загрузить свой репозиторий GitHub. Я использую интеграцию Pycharm с GitHub, и на всю жизнь я не могу понять, как заставить Pycharm забыть, что у меня когда-либо была установка репозитория GitHub, и просто начать с нуля.
Я даже попытался переместить файлы .git в другое место и очистить кеш Pycharm, но эта проклятая штука все еще помнит, что у него есть репозиторий Github, хотя он больше не существует на GitHub.
Кто-нибудь знает, как заставить Pycharm забыть?
1 ответ
Change Local History retention period
By default, Local History is configured to store revisions for the last 5 working days (that is, days when the file was modified).
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Advanced Settings .
In the IDE section, provide the desired retention period value in the Duration of storing changes in Local History field.
Alternatively, you can pass the localHistory.daysToKeep parameter as a Java property by configuring JVM options. For example, to set retention to 30 days, add the following line to the JVM options file:
If you want to disable Local History completely, set the retention period to 0 .
Location of Local History files
Local History is stored as binary files under the LocalHistory subdirectory in the PyCharm system directory:
PyCharm caches a great number of files for all projects that you have ever worked with in this IDE version, therefore the system cache may become overloaded. Sometimes the caches will never be needed again, for example, if you work with frequent short-term projects.
When you invalidate the cache, PyCharm removes the cache files for all projects ever run in the current version of the IDE. The files will be recreated the next time you open these projects.
Note the following before you proceed:
The caches will not be deleted until you restart PyCharm.
Opening and closing a project without invalidating the cache does not result in deleting any cached files.
Local History is not deleted when you invalidate the cache unless you explicitly enable this option in the Invalidate Caches dialog. However, mind that Local History has a retention period of 5 working days by default.
Чтобы удалить все .git и начать, вы можете запустить
В корне репо (это приведет к удалению каталога .git, необратимое изменение), а затем запустить git init
Спасибо за подробный ответ. Я пытаюсь сбросить репозиторий git до текущих локальных изменений. I.E. Удалите удаленное репо (что я уже сделал с веб-сайта GitHub) и повторно загрузите все локальные файлы с нуля. Кажется, что предложенный вами жесткий сброс сделает прямо противоположное и сотрет и локальные изменения, чтобы они соответствовали исходной фиксации. (Я нахожусь в Windows) Я также попытался стереть папку .git в корне проекта. Пихарм все еще помнит .
Local History helps you constantly track all changes made to a project independently of version control.
Unlike version control systems, which only keep track of the differences made between commits, Local History offers much more. It automatically records your project's state as you edit code, run tests, deploy applications, and so on, and maintains revisions for all meaningful changes made both from the IDE and externally.
Acting as your personal version control system, Local History lets you restore deleted files, bring back separate changes, or roll back to any state of a file even if no version control is enabled for your project yet, or if an unwanted change was made after your last commit. It may also serve as a recovery source if your computer restarts unexpectedly before you can take any action.
Note that Local History is not a replacement for a proper version control for long-term versioning. Local History is cleared when you install a new version of PyCharm. It also has a retention period and maximum size, so revisions are not guaranteed to persist.
Чтобы отсоединить репозиторий git от GitHub,
Ввод git remote -v отобразит список настроенных пультов дистанционного управления.
Чтобы удалить пульт, вы можете,
Или в более старых версиях git,
Чтобы добавить новое репозиторий github в качестве удаленного, вы можете
Чтобы сбросить ветку до начальной (или любой конкретной) фиксации,
В version control > log прокрутите вниз до начальной (или любой конкретной) фиксации
И нажмите Reset Current Branch to Here.
Затем выберите жесткий
И нажмите сброс. (это необратимое изменение)
Чтобы передать изменения в локальном репо в удаленное репо (после сброса на локальное до желаемой фиксации), запустите push с -f , который принудительно обновит удаленный. убедитесь, что удаленная ветка не защищена от push -f .
3 ответа
Вы можете очистить старые интерпретаторы PyCharm, которые больше не связаны с проектом, через «Настройки» -> «Интерпретатор проекта», нажмите на шестеренку в правом верхнем углу, затем нажмите «Еще». Это дает вам список, в котором вы можете избавиться от старых виртуальных файлов, которые, по мнению PyCharm, все еще существуют. Это предотвратит появление частей "(1)", "(2)".
Вы не хотите превращать virtualenv в корень содержимого. Код вашего проекта - это корень содержимого.
В качестве предложения:
Сделайте virtualenv вне PyCharm
Создайте новый проект, используя шаблон Django PyCharm
Тогда у вас должен быть рабочий пример.
В дополнение к приведенному выше ответу, который удалил Venv из списка Pycharm, мне также пришлось перейти в мой каталог ~ / venvs и удалить там связанную папку каталога.
Когда виртуальный env включен, в нижней части pycharm в той же строке с терминалом и TODO будет активен символ V. Когда вы нажмете на «V», первый будет отмечен галочкой. Просто щелкните по нему еще раз. Тогда он отключится. Так просто, как, что.
Restore deleted files
If you've accidentally deleted a file that was not under version control, you can restore it with Local History.
Select the node that contained the file you deleted in the Project tool window, right-click it and choose Local History | Show History from the context menu.
On the left, select the revision that contains the file you want to restore, right-click that file, and choose Revert Selection .
Add labels to specific states Local History
Local History revisions are normally marked with timestamps, which are not easy to navigate. Some revisions are automatically marked with labels based on predefined events: running tests, deploying apps, committing changes, and so on. You can always add a new label to mark the current state of the Local History, for example right before you start a massive refactoring.
Select File | Local History | Put Label from the main menu.
In the dialog that opens, type any meaningful name for the label and click OK .
Clear the system cache
From the main menu, select File | Invalidate Caches .
In the Invalidate Caches dialog, you can select additional actions that the IDE will perform while removing the cache files:
Clear file system cache and Local History : remove the virtual file system cache together with the information stored in Local History.
This action might be helpful for troubleshooting purposes when the usual cache invalidation is not enough to solve the problem.
Clear VCS Log caches and indexes : remove the cache and indexes of the VCS Log.
Enable this option if you are certain that your VCS Log indexes are broken, for example, if the Log search doesn't work correctly.
Mark downloaded shared indexes as excluded : clear the downloaded shared indexes and place them to the list of excluded files. It means that PyCharm won't re-download the excluded shared indexes.
Ask before downloading new shared indexes : show a notification prompting you to download new shared indexes as they become available.
Enabling this option also updates your settings for shared project indexes in Settings/Preferences | Tools | Shared Indexes .
Click Invalidate and Restart .
If you click Just restart , cache files won't be deleted, and the selected optional actions won't be applied.
We recommend that you restart the IDE via Find Action : press Ctrl+Shift+A and type Restart IDE .
For details on where various user-specific files are stored, see Directories used by the IDE.
Навигация по коду:
Ctrl + N -- перейти к классу
Ctrl + Shift + N -- перейти к файлу
Ctrl + Alt + Shift + N -- перейти к произвольному символу
Alt + Shift + 7 -- найти все использования класса/функции
Ctrl + B -- перейти к определению
Ctrl + F12 -- показать структуру файла
?? Alt + Shift + 1 -- показать структуру проекта
Ctrl + Shift + Backspace -- перейти в последнее отредактированное место
F3 / Shift + F3 -- перейти к следующему/предыдущему найденному элементу
Ctrl + E -- показать список последних посещенных файлов
Alt + Shift + C -- показать историю действий проекта
Ctrl + . -- свернуть блок кода
Alt + Shift + Left -- прыгнуть назад
Ctrl + Shift + M -- прыгнуть к открывающей/закрывающей скобке
Ctrl + Shift + E -- быстрая навигация по внесённым изменениям
Навигация по редактору:
Escape -- перейти из tool window в редактор
Shift + Escape -- закрыть tool window и перейти в редактор
F12 -- перейти в последнее используемое tool window
Alt + Right / Alt + Left -- перейти к следующей/предыдущей вкладке
Ctrl + Tab / Ctrl + Shift + Tab -- открыть список вкладок и перейти к следующей/предыдущей вкладке
Ctrl + Shift + A -- найти действие (в редакторе)
Ctrl + F4 -- закрыть вкладку
Ctrl + Space -- открыть автодополнение по идентификаторам из кода
Ctrl + Space, Ctrl + Space -- открыть автодополнение даже по неимпортированным классам (будет импортировано автоматически)
Ctrl + Q -- быстрая документация
Shift + F6 -- переименовать символ
Ctrl + W -- расширить выделение
Ctrl + D -- дублировать строку или выделенный блок
Ctrl + Shift + Up / Ctrl + Shift + Down -- переместить строку вверх/вниз
Ctrl + Shift + J -- объединить две строки
Ctrl + P -- (между скобок в вызове функции/метода) показать параметры
Ctrl + Shift + F7 -- найти/подсветить использование переменной в текущем файле
Alt + Up / Alt + Down -- перейти к предыдущему/следующему методу
Ctrl + Shift + V -- показать историю буффера обмена и вставить
Ctrl + / -- закомментировать/раскомментировать строку/выделенный блок
Ctrl + Alt + T -- обернуть текущую строку в if, while, try / except или try / finally
Как удалить все следы устаревших проектов из PyCharm?
Предыстория: сегодня я обновился с PyCharm Community Edition до PyCharm Pro Edition. Причина заключалась в том, что я мог работать над проектами Django, в частности над только что появившимся унаследованным проектом под названием «сделки».
Я удалил устаревшие папки проекта.
Затем я открыл Pro Edition и прошел этапы создания проекта Django под названием «сделки» с интерпретатором python3.4 в virtualenv.
Поэтому я удалил его (т.е. удалил папки как в ~ / .virtualenvs / deal, так и в ~ / Projects / deal).
Я попробовал еще раз, хотя на этот раз получил переводчик с суффиксом числа, т.е. python3.4 (1). Я продолжил и получил ту же пустую файловую структуру.
Я снова удалил обе папки, пошел и очистил интерпретаторы в «Настройки»> «Интерпретаторы проекта».
Затем я попробовал еще раз, получив «новые» интерпретаторы, пока, наконец, не получил python3.4 (5) Plus, попутно я также аннулировал кеши и перезапустил. (например, Файл> Недействительные кеши / перезапуск)
Затем, чтобы доказать, работает ли это вообще, я попробовал новое название «мусор». На этот раз все сработало нормально, и я мог видеть папки Django в проводнике PyCharm. Отлично.
Но я действительно хочу работать над проектом под названием «Сделки». Поэтому я снова удалил все папки сделки и снова попытался создать проект Django сделок. Тот же результат.
После поиска в Google я зашел в Настройки> Структура проекта> + Корень содержимого и указал его на папку ~ / .virtual / deal.
Хорошо, теперь я мог видеть файлы в виртуальном env, но там нет файлов Django, и, кроме того, папка проекта была отделена от папки virtualenv, например
-
сделок (~ / project / deal) 3
Restore changes
Let's imagine you made a series of changes to a file since your last commit before your realized you've deleted a meaningful chunk of code. The Undo action can't help you here because that change is too far away and you'll be forced to discard other changes if you use it.
With PyCharm you can restore that change in a couple of clicks.
Right-click anywhere in the editor and choose Local History | Show History from the context menu.
In the dialog that opens, the left-hand pane shows a list of all saved revisions of the current file with timestamps. The right-hand pane shows a diff viewer which displays the differences between each revision and the current state of the file.
Do one of the following:
To revert the whole file or directory to the state of this revision, right-click it and choose Revert from the context menu or click on the toolbar.
To restore a specific code fragment, select the revision that contains that fragment. In the diff view on the right locate the piece of code you want to restore click the chevron button to copy it from the left pane.
Share Local History
Local History does not support shared access, it is stored locally and intended only for personal use. However, you can create a patch file with changes relative to a specific revision, which you can share with others.
Select a revision in Local History dialog and click Create Patch on the toolbar.
In the dialog that opens, specify how you want to create the new patch.
Читайте также: