GIT overwrite a branch with the contents of another branch

Today I decided to nuke the contents of the dev branch in a project I’m working on. I wanted to reset it back to the last stable copy and develop from there. Rather than delete the dev branch I wanted to overwrite it with the contents of the master branch. To do this I discovered I needed to perform a “hard reset” with GIT of the branch with the contents of the master branch. For those of you who want to do this I have provided the details below:

$ git checkout <branch name>
$ git tag old-<branch name>-branch
$ git reset --hard <branch you want to use to overwrite>

Subscribe to my feed either by E-mail or by RSS to receive updates as they happen.

Can you improve on any of the tips I’ve discussed here? If you can let me know in the comments.

Jason Edwards