let say in a repo there are commit1 and after that commit2.
commit2 has .gitignore file changed, and some files ignored.
If I checkout to commit1, those ignored files becomes untracked files and prevent me to checkout back to commit2.
What would be the best way to checkout back to commit2, without touching those ignored files?
git stash would delete those files from workspace first, which I don't prefer.
 
    