How can I check out a commit version of a branch in git
?
For example, my branch, Dev
, has a commit ad4f43af43e
. How can I check o
git checkout # non named commit
git checkout # named commit
The two lines above will place the HEAD pointer on the given commit. You should know that a branch name is a commit, except it can evolve if you a new commit is added when you're on that branch.
If you want to place your branch Dev
on the commit ad4f43af43e
you can do this
git branch -f Dev ad4f43af43e
Be careful! This is dangerous because you may loose commits