Skip to content

Instantly share code, notes, and snippets.

@resourcemode
Created June 27, 2017 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save resourcemode/4f8296cbbc54a528009267e3490d74b6 to your computer and use it in GitHub Desktop.
Save resourcemode/4f8296cbbc54a528009267e3490d74b6 to your computer and use it in GitHub Desktop.
Delete git branches using sh script
#!/bin/sh
## declare an array variable
branches=("develop" "master")
repositoryPath="/Users/michael.favila/project/trading-platform"
## now loop through the above array
for i in "${branches[@]}"
do
echo "$repositoryPath ${i}"
cd "$repositoryPath" && git branch -D "${i}"
# or do whatever with individual element of the array
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment