GIT clone a repository based on commit.

Assume that one of the files you needed were deleted accidently and already committed to the current branch and on top of that you had done several commits. However, still you need to get that deleted file.

First identify the commit that just prior to the deletion of the file.

Easy way is identify via GITLAB.

So it’s 91ae3305c61ce8803148dfcdc788ec5d2a6c7ecc

Then to a new location, clone the particular branch using GIT CLI.

Then type below command to get the branch in the commit.

Using this can get the branch in that commit.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store