Restore deleted GitHub commits #22541
-
|
I deleted most of my GitHub commits in a repo. How can I get them back? My local clone is more than a week old… |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
What exactly did you delete? You can’t delete commits via the web interface, unless you delete the whole repository (or branch). |
Beta Was this translation helpful? Give feedback.
-
|
whoops! Just realized that it was in my other local clone where I deleted my commits… |
Beta Was this translation helpful? Give feedback.
-
|
I deleted most of my GitHub commits in a repo. How can I get them back? there isn't a local clone |
Beta Was this translation helpful? Give feedback.
-
|
To restore a deleted commit in a GitHub repository, you can utilize the git reflog command to locate the commit's SHA hash and then use git reset --hard to restore it. This works by accessing a log of recent actions on the repository, including commits that have been deleted. |
Beta Was this translation helpful? Give feedback.
whoops! Just realized that it was in my other local clone where I deleted my commits…