This is a very sensible rule that protects you from inadvertently losing commit data. It is two seperate files so that you could call deletebranches.sh directly, specifying a remote and piping in the branchnames to delete. In some cases, Git might refuse to delete your local branch: when it contains commits that haven't been merged into any other local branches or pushed to a remote repository. Typical usage is to just run cleanupremote.sh to see the switches required, then repeat it with -dry-run, adding to the third parameter until there are no unwanted branches listed: cleanupremote.sh -dry-run origin 'master|develop|feature/oh_not_that_one_I_need_it'Ĭleanupremote.sh -really-delete origin 'master|develop|feature/oh_not_that_one_I_need_it' Listbranches | deleteremotebranches.sh $remote Git branch -r -merged | tr -d ' ' | sed "s/$remote\///" | grep -vå "$excludes"Ä®cho "The following branches would be deleted:"Ä®cho "Error: first parameter must be either -dry-run or -really-delete" git checkout git push origin -set-upstream git push origin -delete .but to push it, you must delete the old and push the new. The default remote to cleanup is called origin, but this can be specified as the second parameter, and the excluded branches are the third parameter. the feature move exists to rename the branch locally. If you agree, you can use these two bash scripts (put them in PATH, the one calls the other). For me, 'unused' branches are defined as anything merged into the current branch, that is not called master, develop, or release/*.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |