sometimes while working on git repo i get in that situation where i have added new files after commit then i needed to checkout a previous commit the problem is when doing so i stuck with those new files i have created. so is there any way to clean those new untracked files and still be able to retrieve them after resting the HEAD and back to master?
i tried to stage everything and then stash all of it, running clean, and finally checkout whatever commit i want but this has the drawback of manually trying to unstage all the file that i don't want to be tracked be git