Last active
May 14, 2024 16:25
-
-
Save flaxel/fc9f8f721765fb4c41d1db7ccc1b5148 to your computer and use it in GitHub Desktop.
Revisions
-
flaxel revised this gist
Oct 19, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ update(){ current_branch=$(git rev-parse --abbrev-ref HEAD) # update branch repository [[ $current_branch =~ ^(master|main)$ ]] && git pull --ff-only --all -p || git pull --ff-only origin $current_branch # cleanup local branches git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -D -
flaxel revised this gist
Oct 14, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -27,7 +27,7 @@ update(){ [ $current_branch = "master" ] && git pull --ff-only --all -p || git pull --ff-only origin $current_branch # cleanup local branches git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -D } # check necessary installations -
flaxel revised this gist
Sep 22, 2020 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,6 +25,9 @@ update(){ # update branch repository [ $current_branch = "master" ] && git pull --ff-only --all -p || git pull --ff-only origin $current_branch # cleanup local branches git branch --merged | egrep -v "(^\*|master|main)" | xargs git branch -d } # check necessary installations -
flaxel revised this gist
Jun 10, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ update(){ current_branch=$(git rev-parse --abbrev-ref HEAD) # update branch repository [ $current_branch = "master" ] && git pull --ff-only --all -p || git pull --ff-only origin $current_branch } # check necessary installations -
flaxel created this gist
Jun 3, 2020 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #!/bin/sh # check if console program is installed check_installation(){ type $1 >/dev/null 2>&1 || { echo >&2 "$1 is required: $2 Aborting."; exit 1; } } # printing usage information usage(){ echo "This program is used to update all git repositories in the given folder." echo "Usage: $0 <folder>" exit 1 } # update a git repository update(){ # printing action echo "\nUpdating $1 ..." # change directory to repository cd "$1" # get current branch current_branch=$(git rev-parse --abbrev-ref HEAD) # update branch repository [ $current_branch = "master" ] && git pull --ff-only --all -p || git pull origin $current_branch } # check necessary installations check_installation "git" "Please download git from https://git-scm.com/downloads." check_installation "realpath" "Please install realpath with 'sudo apt install realpath' or 'brew install coreutils'." # check if arguments passed [ $# -eq 0 ] && usage # printing action echo "Update all git repositories..." # absolute origin folder folder=$(realpath $1) # update repositories with .git folder for git_folder in $(find $folder -name '.git'); do update $(dirname "$git_folder"); done