To remove the last commit from git, you can simply run git reset —hard HEAD^ If you are removing multiple commits from the top, you can run git reset —hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.
- 1How to Install Git on Ubuntu 18.04?
- 1Which is the right way to reflect already pushed changes to local branch?
- 1SVN vs Git: Which One Is Best For Your Needs
- 1How make git commands shorter
- 5How can I rename git local and remote branch name?
- 1Git - clone another project branch to current project
- 1How to check does a specific branch contains a given commit in Git
- 1Remove files from Git commit
- 1Differences between 'git pull' and 'git fetch'?
- 2How to get the current branch name in Git?
- 1How do I rename a local Git branch?