git branch -D <branch_name> will delete the branch even if there are unmerged commits. If you have untracked files you can then do git clean -f to delete all the untracked files.
Beware that git clean -f is unrecoverable. You may be able to recover from git branch -D using git reflog, but git can’t restore files it never knew about.
@derekprior; I tried that out and learned that it does, in fact, delete the branch. However, any uncommitted changes are still left in the index. To use this approach, what I believe has to be done is:
git add any changes made during the experiment
git commit those changes into the branch
git delete the branch as you suggested
Then do the git clean -f to get rid of any untracked files.
What I was looking for is a command to do the following:
Issue a git reset HEAD <file> command to unstage any files in the staging (index) area
Issue a git checkout -- <file> command to ‘unmodify’ any tracked files that have been changed
Researching, I think that means doing:
git reset --hard master
if the master branch contains the state prior to initiating the experimental branch, followed by deleting the branch as you suggested and then removing any new, untracked files.