How to Restore the Original Commit History? #106718
Replies: 5 comments
-
For a full explanation check this link. |
Beta Was this translation helpful? Give feedback.
-
Let me know if you need any clarification or have additional questions! |
Beta Was this translation helpful? Give feedback.
-
You can use the git revert command to return your repository's files to a previous state without rewriting the commit history. This is done by creating new commits that do the opposite of existing commits, i.e. removing lines and files that were added and adding lines and files that were removed. |
Beta Was this translation helpful? Give feedback.
-
git revert commit |
Beta Was this translation helpful? Give feedback.
-
Thanks for posting in the GitHub Community, @sanjeevmansotra1 ! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Discussions category is solely related to conversations around the GitHub product Discussions. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hello my name is Sanjeev Mansotra. One of your team members accidentally force-pushed to the master branch, overwriting some important commits. As a result, the commit history is now different from the remote repository. How to revert the force-push and restore the original commit history?
Explain the step-by-step process you would follow to achieve this, considering the need to communicate effectively with your team and maintain a clean version history.
Waiting for your response!
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions