How to revert to an earlier commit on a repo?

I’ve checked the docs and I don’t see anywhere how I can revert to an earlier commit. I know how to do this with git, but I don’t want to download or checkout such large files.

The hash of the earlier commit is easily accessible.

1 Like

hi @RonanMcGovern,

I looks like you don’t have a copy of the repo locally right?
You could try using GIT_LFS_SKIP_SMUDGE=1 to only copy references to LFS, then you reset to a specific commit hash, and force push? Make sure you duplicate your space/dataset/model before testing this, here is a duplicator

git lfs install
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/USER/REPO
git reset --force HASH
git push --force
2 Likes

Ah this is much appreciated @radames, thanks

1 Like

Instead of git reset --force HASH, shouldn’t the command be git reset --hard HASH?

1 Like

yeah, thanks for that:

git lfs install
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/USER/REPO
cd REPO
git reset --hard HASH
git push --force
1 Like