Skip to content
Discussion options

You must be logged in to vote

If GitHub has forced changes or you need to restore previous changes, you can recover them depending on the situation:

1. Restoring from Local Repository

If the changes exist locally:

  • Use bash git reflog to find the commit hash of the previous state.

  • Run bash git reset --hard to revert the repository to that state.

2. Using GitHub's UI

If the changes are in a branch or pull request:

  • Navigate to the specific branch or pull request in the GitHub repository.

  • Use the History section to view previous commits.

  • Create a new branch or revert directly from the UI using the "Revert" option available on specific commits.

3. Restoring Deleted Branches

If a branch was deleted:

  • Check if…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TabawaX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New To GitHub 👋 New To GitHub Question Ask and answer questions about GitHub features and usage
2 participants