gitgithubbranching-and-merging

Automatically delete git branch after merge to master


We will be attempting a work flow in github where every ticket is a branch off of master.
After the ticket is complete, the work is merged into staging where regression and integration tests are performed before it is merged into master.

A team lead brought up the issue of the old ticket branches after a merge will start to build up.

I found this script and want to know if this would work in our environment. We only want to delete branches that have been merged into master.


Solution

  • 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.