IF you have NOT pushed your changes to remote
git reset HEAD~1
Check if the working copy is clean by git status
.
ELSE you have pushed your changes to remote
git revert HEAD
This command will revert/remove the local commits/change and then you can push
More Related Contents:
- How to modify existing, unpushed commit messages?
- Message ‘src refspec master does not match any’ when pushing commits in Git
- Commit only part of a file in Git
- Remove sensitive files and their commits from Git history
- How do I commit case-sensitive only filename changes in Git?
- How can I remove a commit on GitHub? [duplicate]
- How do I push amended commit to the remote Git repository?
- Edit the root commit in Git?
- Undo git reset –hard with uncommitted files in the staging area
- git: Your branch is ahead by X commits
- Skip Git commit hooks
- What is a Git commit ID?
- How does git commit –amend work, exactly?
- How to change the commit author for a single commit?
- Remove file from latest commit
- How to amend several commits in Git to change author
- How do I make a Git commit in the past?
- How to fix committing to the wrong Git branch?
- What is the Sign Off feature in Git for?
- What is a dangling commit and a blob in a Git repository and where do they come from?
- Accidentally pushed commit: change git commit message
- Git commit that doesn’t override original authors in git blame
- How can I change the default comments in the git commit message?
- How can I undo a `git commit` locally and on a remote after `git push`
- How to see commits that were merged in to a merge commit?
- Using IntelliJ to amend git commit message
- Telling if a Git commit is a Merge/Revert commit
- Xcode 9 commit: Couldn’t communicate with helper application
- Why does ‘git commit’ not save my changes?
- Is it possible to set a git commit to have a timestamp prior to 1970?