What is the git commands to delete unwanted commits that haven't been pushed to the remote?
I don’t want to pollute the main tree with unwanted commits.
3 Solutions collect form web for “What is the git commands to delete unwanted commits that haven't been pushed to the remote?”
If you haven’t yet pushed them to the remote, it should be easy to delete them.
git branch -D <branch-to-delete>
will forcibly delete a branch that you don’t want to keep.
Try looking up rebase- there is a good series of videos here: http://www.ava.co.uk/git
Try this one. This way it’s possible to drop single commit. I assume the commit you want to drop is no further than 16 steps back from the HEAD.
git rebase -i HEAD~16...HEAD