Lost weeks of work organizing branch in a repository #165191
Replies: 5 comments 3 replies
-
|
If you have the repo locally, check the git reflog by running this command in your terminal:
Look for the commit hash you want (the one before you did the force push), and then do:
If you don't have the commit locally, check if any team members do, or check any PRs or branches that might have the commit. |
Beta Was this translation helpful? Give feedback.
-
|
Just adding to what was already suggested above, If you or anyone on the team don’t have the commits locally and there’s no backup branch or PR containing them, it could be worth reaching out to GitHub Support. Sometimes they can help recover commits that were accidentally overwritten by a force push, especially if it happened recently. Also, for the future, it’s a good idea to quickly create a backup branch before doing a git checkout -b backup-before-force
git push origin backup-before-force |
Beta Was this translation helpful? Give feedback.
-
|
Yes, it is possible to restore a repository state even after a force push, as long as the previous commits still exist in your local Git history (reflog) or on the remote server. If you made the commit and pushed it before the force push, you can use |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Wrong push and organization
Question
Body
Is there a way to restore a repository that has been modify yesterday? It does not show in Deleted Repositories because I didn't deleted, I reorganized the main branch because we had some wrong alignment in it and the project went back too many weeks. Before I organized the main branch, I had made a commit and push with the current project, is there a possibility to restore it to that version even thought we force --push and overwrite them wrongly?
Beta Was this translation helpful? Give feedback.
All reactions