Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Focusing

Marcio Gomes MarcioGomes78

💻
Focusing
View GitHub Profile
@adrianoluis
adrianoluis / git-refresh.sh
Last active July 3, 2022 17:50
Update master in all git repo under the provided directory or if missing uses running directory.
View git-refresh.sh
#!/bin/sh
GITROOT="${1:-.}"
find $GITROOT -name .git -type d | cat -n | while read n f
do
cd "$(dirname "$f")"
GITDEFBR="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')"
GITPROJ="$(pwd -P)"
echo "\033[32m>>> \033[1m$GITPROJ\033[0m\033[21m"
GITBRANCH=$(git rev-parse --abbrev-ref HEAD)
git add .