loading...

Remove all Git branch except 1 with Single Script

ridhoperdana profile image Ridho Perdana ・1 min read

Hi all, I am just learning about shell script. And I also have too many unused branch in my workspace.
So I decided to create a simple script to run a git command, which can delete all branch except 1 branch.

The script is simple, it's only taking a single argument that will replace the branch name inside the git command.

With this script, I learned about:

  • Taking argument in a script
  • Make and calling a function in a script
  • Calling a command inside a script

You can see the script here:
https://github.com/ridhoperdana/brove

Have a nice weekend! 🖖

Discussion

markdown guide