Delete the most recent commit, keeping the work you’ve done:
git reset --soft HEAD~1
Delete the most recent commit, destroying the work you’ve done:
git reset --hard HEAD~1
More Related Contents:
- Remove sensitive files and their commits from Git history
- Checkout another branch when there are uncommitted changes on the current branch
- Can I ‘git commit’ a file and ignore its content changes?
- After $git push -u origin main command, Git bash is not requesting any authentication literally does nothing
- How to remove files that are listed in the .gitignore but still on the repository?
- Git – Ignore node_modules folder everywhere
- In Git, how can I write the current commit hash to a file in the same commit
- Why am I getting the message, “fatal: This operation must be run in a work tree?”
- Git workflow – Setting up a build process
- What are some more forceful ways than a .gitignore to keep (force) files out of a repository?
- Can a Git hook automatically add files to the commit?
- git – cherry-pick – HOWTO / WHYTO
- Making Git retain different section content between branches
- How to push a local Git repository to another computer?
- git: symlink/reference to a file in an external repository
- .ssh/config file for windows (git)
- git commit frequency
- How does git handle folder permission?
- How to rebase one Git repository onto another one?
- How do I change case of the names of multiple files, already committed?
- Is there a way to limit the amount of memory that “git gc” uses?
- Git submodules and ssh access
- What is the difference between git am and git apply?
- How can I find the location of origin/master in git, and how do I change it?
- How do I contribute to other’s code in GitHub? [closed]
- How to update Git clone
- Can I push/pull directly from my google drive online?
- How to get Git diff of the first commit?
- Git – Unlink of file .idx and .pack failed (The only process owned handle to this file is git.exe) [duplicate]
- Make git diff show UTF8 encoded characters properly