From e4f49df364e8181e4a8f305fc031b00969d805a5 Mon Sep 17 00:00:00 2001 From: Prabodh Meshram Date: Fri, 8 Dec 2017 01:30:24 +0530 Subject: [PATCH] added Code to prompt user if he wants to fetch repo before pruning --- scripts/git-prune.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/git-prune.sh b/scripts/git-prune.sh index 295d351..3c4cd34 100755 --- a/scripts/git-prune.sh +++ b/scripts/git-prune.sh @@ -2,6 +2,14 @@ #Script to prune / delete the local git script +# Check if needed to fetch before prooning + +read -p "Do you wish to perform git fetch ? (Y/N) " yn + +if [ $yn = "Y" ]; then + git fetch -p +fi + remote_branches_string=$(git for-each-ref refs/remotes/origin | cut -d/ -f4) remote_branches=(${remote_branches_string// /})