#!/bin/bash git checkout -b tmp git branch -f master tmp git checkout master git branch -d tmp git commit -m "Merged detached head into master" .