In general you can switch between the various Git Branches. But how it will look, if someone like to switch between the various Git Commits?
On case would be. You working on a feature. You checked out to the feature-branch and writing your code. You made some smaller commits. Then you will come to the point where you speak to your self: Hmm, better i do it like some commits before. But you already overrided this function and already fired some commits inner this feature branch. The recovery function from your IDE cant bringed back this function. It lost as well? You need this earlier function. But how can i get there.
Follow this steps:
git log --oneline --all
git checkout 20963d0
And you are checked out to the previoust commit with:
git checkout 20963d0 .Fetch your code and jump back to your current commit. Because the old commit are “detached HEAD”. and any changes on this commit will delete your commits afterwards.