![]() The “–hard” option is used in order to reset the files of the index (or the staging area) and of the working directory. The purpose of the “git reset” command is to move the current HEAD to the commit specified (in this case, the HEAD itself, one commit before HEAD and so on). $ git reset -hard HEAD~2 (going back two commits before HEAD) $ git reset -hard HEAD~1 (equivalent to "^") $ git reset -hard HEAD^ (going back to the commit before HEAD) $ git reset -hard HEAD (going back to HEAD) ![]() To hard reset files to HEAD on Git, use the “git reset” command with the “–hard” option and specify the HEAD. In this section, we are going to describe how you can hard reset files on Git. When resetting files on Git, you essentially have two options : you can either hard reset files or soft reset files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
September 2023
Categories |