Git clone particular version of remote repository

nandu picture nandu · Aug 24, 2010 · Viewed 292.6k times · Source

I cloned a remote git repository about a month ago. The remote repository has undergone many changes and has now become unstable. Now I need another copy of the repository, version identical to the one I cloned a month ago.

How do I do this?

Answer

Rui Carneiro picture Rui Carneiro · Aug 24, 2010

You could "reset" your repository to any commit you want (e.g. 1 month ago).

Use git-reset for that:

git clone [remote_address_here] my_repo
cd my_repo
git reset --hard [ENTER HERE THE COMMIT HASH YOU WANT]