If I replace (for example) an image in the static files of my Django project, which I already displayed on certain pages: Is there a simple and reliable way to find these places in the code where I need to replace the path to the old image with the new one?
- solution: reply by Adam in the Django forum👌🙏
Table of Contents
Find strings in code – explanation for VSCode and git
There are several approaches to find the respective part in your code/files.
VSCode
In VSCode one has three different options to find parts in the code for replacement.
Search Icon (VSCode): find parts in your code for replacement
- use search icon in upper left corner of VSCode
![search-find-in-files](https://samuelhartmann.de/wp-content/uploads/2022/02/search-find-in-files.png)
- type search term into search field -> all files containing the term will be listed below
![search-find-in-files-term](https://samuelhartmann.de/wp-content/uploads/2022/02/search-find-in-files-term-1024x203.png)
Command Palette (VSCode): find parts in your code for replacement
- use Command Palette (F1) and find the respective command (find in files)
![command-find-in-files](https://samuelhartmann.de/wp-content/uploads/2022/02/command-find-in-files.png)
Keyboard Shortcut (VSCode): find parts in your code for replacement
- keyboard shortcut for find in files command: CTRL + Shift + F
Git – command line
git grep <search-term>
![git-grep-find-code](https://samuelhartmann.de/wp-content/uploads/2022/02/git-grep-find-code.png)
Neueste Kommentare