biviosoftware / home-env

MIT License
2 stars 2 forks source link

Fix #10: delete branches with no remote tracking branch #53

Closed e-carlin closed 2 years ago

e-carlin commented 2 years ago

To delete all merged branches folks reccomend using git branch --merged to source them. Parsing git branch is not reccomended https://stackoverflow.com/a/26152574/5518313. Likewise, we do squash merges. In those merges the original branch is left intact and from the perspective of git unmerged. So, --merged won't pick them up.

After we merge we delete branches. So, we can delete all local tracking branches where the remote branch has been deleted. This has the added benefit that if a branch is unmerged but deleted (ex a pr was proposed but ultimately not merged) then we will clean up that branch too.

This doesn't work on centos7. The git there doesn't support the :track syntax.

robnagler commented 2 years ago

merge conflicts so you'll need to fix