Whoops we made a mistake!
Let's say for example that you committed a file that contains an API key. Or perhaps you committed the wrong files all together
Maybe you forgot to set up your .gitignore and a bunch of cruddy files got committed and pushed and you project is a mess now (looking at you npm) 😆
1link$# Reset the local copy to a previous commit
2link$git reset --hard <ID#Of_Commit>
3link$
4link$# Force push the local copy to the remote repository
5link$git push --force
1link$git checkout -F | git reset --hard (you cannot undo a hard reset)
1link$git revert HEAD (Creates a new commit)
1link$git revert $id (Creates a new commit)
1link$git commit -a --amend (after editing the broken files)
1link$git checkout <ID><file>
2link$
Home Backstory Why Git? Setting Up GitHub GitHub CLI Your GitHub Profile GitHub Pages Creating A New Repo Cloning A Repository Your First Commit Ignoring Files In Git Stashing Your Changes Branching With Git Merging Git Branches Rebasing Vs Merging Git Workflows Fork And Pull Flow Your First Pull Request Automated Security Alerts Seeing The Differences Removing/Deleting Files Reverting Your Commits Configuring your Git Commit Templates Creating Shortcuts Dotfile Management Sponsoring Open Source Handy Commands Thank You