If I use:
$ git reset --hard HEAD~N
or
$ git checkout HEAD~N
Both of two will use the version of HEAD~N to change working directory and stage area.
If there is any different between these two commands?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
git checkout HEAD~Nis meant to examine the commit and not to be worked on as it will create a detached head state. If you want to reset (the current branch head) to a particular commit, you usegit reset [--hard]