Get a List of All Git Repos Under Project Directory && Delete All Branches Except Master

Programming articles
Written by @kiosmerdeka

One way to get a list of all Git repos under your current directory (project directory) is with the following command:

find . -name '.git' | xargs -n 1 dirname

To delete all branches in your Git repository except master, simply issue the following command:

git branch | grep -v "master" | xargs git branch -D
Baca juga  Transfer Cepat File dan Direktori: Panduan Menggunakan Rsync antara Server di Linux

Leave a Comment