Skip to content

Instantly share code, notes, and snippets.

@jrichardsz
Last active March 30, 2023 22: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 jrichardsz/8de81161f2512ed377380f6322e75a96 to your computer and use it in GitHub Desktop.
Save jrichardsz/8de81161f2512ed377380f6322e75a96 to your computer and use it in GitHub Desktop.
git snippets
base_location=$(dirname "$0")
echo "$folder_name" > history.md
while read git_url; do
echo "$git_url"
folder_name=$(echo "$git_url" | cut -d / -f 2 | cut -d . -f 1)
if [ ! -z "$folder_name" -a "$folder_name" != " " ]; then
echo "repository was found. Deleting..."
rm -rf $folder_name
else
echo "repository was not found"
fi
mkdir $folder_name
echo "$folder_name" >> history.md
branches=$(git ls-remote $git_url | grep refs/heads | cut -d / -f 3)
echo "$branches" | while read branch ; do
git clone $git_url -b "$branch" "$folder_name/$branch"
rm -rf "$folder_name/$branch/.git"
sleep 2
done
done <repositories.txt

workspace_path=$(pwd) echo "workspace_path:$workspace_path"

cd $workspace_path git add --all

echo "CUSTOM_GIT_AUTHOR=$CUSTOM_GIT_AUTHOR" if [[ -n "$CUSTOM_GIT_AUTHOR" ]] then git commit --author="$CUSTOM_GIT_AUTHOR" -m "$1" else git commit --author="$DEFAULT_GIT_AUTHOR" -m "$1" fi

git push $(git remote) HEAD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment