Returning Commit

It is possible to return the commit in several ways, but the safest way is as follows:

  • First we will use < git log >, to check the hash to which commit you want to return to. E.g:
$ git log

commit 44013a9a0a2225ce100b3e59f554483d06db489 (HEAD -> master)
Date: Wed Jul 15 14:42:30 2020 -0300

fifth commit

commit 5A45c7bb47365dfb6c43cc40e0f6b7b44a34c8b9
Date: Wed Jul 15 14:41:25 2020 -0300

adding git ignore

--> HASH: 5a45c7bb47365dfb6c43cc40e0f6b7b44a34c8b9
  • To return to the commit just copy the hash and follow the next step:
$ git checkout 5A45C7BB47365DFB6C43CC40EF6B7B44A34C8B9

Note: in this way git creates a temporary branch to go back to where you want in the commit, but later we will discuss what branch would be.

GOING BACK TO SOME BRANCH:

$ git checkout master

Note: In case you wanted to go to branch master.

 

results matching ""

    No results matching ""