Hello @Riccardo Santorelli ,
Welcome to Microsoft Q&A forum.
I did a quick test in Visual Studio 2022(17.13.2) unfortunately, i could not reproduce this issue at my side and "Are you sure" window pops up well when clicking Undo. For this issue, i suggest you check the following to troubleshoot.
A workaround: using command line
git checkout — <filename>
1.Changing to a new file/branch/Repository and click "Undo Changes" to check if this issue specific to a file/branch/repo/project.
2.Please check if you have installed any third-party extensions that may conflict with Team Explorer. Try to disable them via Extensions->Manage Extensions.
3.Try to reset Visual Studio settings to their defaults if you have modified some settings.Go to Tools > Import and Export Settings->Choose Reset all settings.
4.Go to other machine where the Team Explorer could work well and copy the Team Explorer folder, then paste to your machine and backup your original folder.
C:\Program Files (x86)\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation
5.Repair your Visual Studio via VS Installer->Repair.
6.If the issue persists, i would you update to the latest version.
Best Regards,
Dou
If the answer is helpful, please click "Accept Answer" and upvote it. Note: Please follow the steps in our documentationto enable e-mail notifications if you want to receive the related email notification for this thread.