Per this comment (and I checked that this is true), rado’s answer is very close but leaves git in a detached head state. Instead, remove HEAD
and use this to remove <commit-id>
from the branch you’re on:
git rebase --onto <commit-id>^ <commit-id>
More Related Contents:
- How to cherry-pick multiple commits
- Removing multiple files from a Git repo that have already been deleted from disk
- How to recover from a git push -force?
- Should “node_modules” folder be included in the git repository
- How do I find and restore a deleted file in a Git repository?
- Git is ignoring files that aren’t in gitignore
- gitignore binary files that have no extension
- Git: What’s the best practice to “git clone” into an existing folder?
- How to revert initial git commit?
- git: Switch branch and ignore any changes without committing
- Git checkout in post-receive hook: “Not a git repository ‘.'”
- ‘Go Get’ Private Repo from Bitbucket
- Git: merging public and private branches while while keeping certain files intact in both branches
- Does git ignore empty folders?
- How to change commit author for multiple commits using filter branch?
- main branch and ‘origin/main’ have diverged, how to ‘undiverge’ branches’?
- git clone, ignoring a directory
- What are the U and M file markers in Visual Studio Code?
- Rebasing and what does one mean by rebasing pushed commits
- How can I rewrite history so that all files, except the ones I already moved, are in a subdirectory?
- How to merge the remote branch and ignore the config setting?
- How do I remove a single file from the staging area (undo git add)?
- How do I run git log to see changes only for a specific branch?
- How to resolve git’s “not something we can merge” error
- List Git commits not pushed to the origin yet [duplicate]
- git – pulling from specific branch
- Jenkins Git plugin detached HEAD
- git merging branches in a bare repository
- GnuTLS recv error (-110): The TLS connection was non-properly terminated
- Can tags be automatically moved after a git filter-branch and rebase?