How to force the compilation of a shader in Unity?

From time to time when writing shaders with CG language in it I get normal errors like syntax errors or some others that everyone makes during normal coding, but sometimes Unity stops recompiling my shaders and keeps a older version compiled ("Open Compiled Shader" option) and does not recompile it until I erase completely the shader and the material assigned and create it from zero with the same shader code.

Is there a way to force a recompilation of the shader? Maybe erasing something in the Assets folder or any other place?

Does right clicking on the shader and doing "Reimport" help?

Right click the file and Select "Reimport", this is the solution provided by the Unity team.

Does this happen when you open the file from the text editor's recent items menu, or when you open the file from the desktop? Unity doesn't always track files if they weren't opened from within Unity. Try closing open shader files and reopening them from Unity.

Since this is a popular question, I’ll add another possibility:

Two shaders can share the same name, with no warning from Unity. Make sure you are editing the correct shader.

THIS WON’T WORK for a compute shader file that includes only constant variables data.
Such a data file won’t recompile even if you reimport it. The only way to update this kind of file that I find for now is to explicitly change the name of the variable you use in both the compute shader and data file and save them. I suppose this is a unity bug that needs fixing.

My unity version: 2020.3.12f1c1