Automatically delete git branch after merge to master

There's no ready-to-use script for your use case as far as I know. You'll have to create your own tools for that.

There is a tool called git-flow by Vincent Driessen which was built to assist developers following his git workflow described in "A successful Git branching model".

It's is not as easy as just deleting the branch after merge because you never know if you'll run into a merge conflict or not.

Github has released a feature where anyone with admin permission to the repository can configure branches to get deleted automatically after pull requests are merged. Here are the steps -

  1. Navigate to main page of the repository and click on Settings.
  2. Under "Merge button", you can select or unselect "Automatically delete head branches" option.

This feature has been released by Github on July 31, 2019.