Skip to content

Commit

Permalink
add recursive git pull
Browse files Browse the repository at this point in the history
  • Loading branch information
pad92 committed Nov 23, 2022
1 parent dfb75aa commit e1514b5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions zsh/functions/git.zsh
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
git_prune_r() {
for REPO in $(find $(pwd) -type d -name .git | sed 's@/.git@@g'); do
echo -ne "- ${REPO}"
PRUNE=$(git --git-dir=${REPO}/.git remote prune origin 2>&1 )
RET=$(git --git-dir=${REPO}/.git remote prune origin 2>&1 )
if [ $? -ne 0 ]; then
echo -ne "\tERROR\n"
echo "$(date +"%Y%m%d-%H%M") ERROR: ${REPO}" >> prune.log
echo "${PRUNE}" >> prune.log
echo "${RET}" >> prune.log
echo "" >> prune.log
else
echo -ne "\tOK\n"
fi
done
}

git_pull_r() {
for REPO in $(find $(pwd) -type d -name .git | sed 's@/.git@@g'); do
echo -ne "- ${REPO}"
RET=$(git --git-dir=${REPO}/.git pull 2>&1 )
if [ $? -ne 0 ]; then
echo -ne "\tERROR\n"
echo "$(date +"%Y%m%d-%H%M") ERROR: ${REPO}" >> prune.log
echo "${RET}" >> prune.log
echo "" >> prune.log
else
echo -ne "\tOK\n"
Expand Down

0 comments on commit e1514b5

Please sign in to comment.