1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00
nux-env/bin/git-all
Tony Tkacik e83ba8a88c Added support for scripts and git-all script.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2015-04-28 09:23:31 +02:00

48 lines
757 B
Bash
Executable file

#!/bin/sh
base_folder=`pwd`
update_branch="master"
method=$1
shift
echo $current_folder;
## pull
pull() {
if [ "$1" = "$update_branch" ]; then
echo " Pulling latest changes"
git pull
else
echo " Skipping pull."
fi
}
## commit
commit() {
echo "Doing Git Commit" $1 $2;
git commit -a -s -m "$2";
}
## execute
execute() {
shift;
eval "$*";
}
##
shell() {
shift;
bash -i;
}
for git_repository in $(find $base_folder -iname ".git" -type d); do
repo_base=$(dirname "$git_repository")
cd "$repo_base"
echo Repository: $(basename $repo_base)
echo " Path:" $(pwd)
current_branch=$(git branch | grep "*" | cut -d" " -f2)
echo " Branch: $current_branch"
echo " Action: " $method
$method $current_branch "$*"
done
cd $base_folder