I forgot to commit on the directory where I was working and then I checkout to the previous commit and now I want to back to the directory where I used to work. What can i do ?
About linux : How-to-go-back-to-the-Working-Directory-that-was-not-committed
If your checkout of the previous version somehow deleted your folder, which was not added/committed, then you would need to rely on a file recovery utility, as detailed in “Can I restore deleted files (undo a
git clean -fdx)?”, or on your IDE. Some of them keep a local history (IntelliJ IDEA, VSCode through an extension, …): you might get back some of your files content that way.
In the end, it depends on the exact
git checkout command you did, considering this command can update files and/or branches.
That is why it is recommanded to use
git switch (branch only) or
git restore (files only), instead of