Remove Pushed Commits from GitHub Repository
- #GitHub
- #Git
Remove Pushed Commits from GitHub Repository
Remove pushed commits from your GitHub repository by using git.
Optional: Backup your repository just in case
cp ../GitHub-Repository ../GitHub-Repository-BackupChoose the last commit you would like to keep
git reset --hard 'git-hash-code'Optional: Remove files not under version control
git clean -f -dPush the last commit you would like to keep to GitHub
git push -fCheck out your GitHub repository by visiting https://github.com/<github-username>/<repository-name> to checkout the changes.
0 Comments
Sign in to join the conversation.