I read on here and searched a lot but didn’t find the answer, so Is there a way to switch between commits like you do with branches.Let’s say I have these commits: a;b;c where c is my last commit, can I switch back to commit a? Or you have to do a git diff and modify the files manually?
I read on here and searched a lot but didn’t find the answer, so
Share
Just type
git checkout a. Or perhaps more usefully,git checkout -b mybranch a, to checkoutaas a new branchmybranch.If you want to revert
bandc, you can usegit revert, or to remove them entirely from your current branch’s history, you couldgit rebase -i aand throw them out.Even if you were going to use
git diff, you wouldn’t have to do anything manually. Check outgit format-patch,git apply, andgit amto automate creating and applying patches.