Last active
June 10, 2020 18:32
-
-
Save thorgeir93/8de88bc831aeec24d8752934f16038ff to your computer and use it in GitHub Desktop.
Run git status on every git repository under the given directory. Useful to find uncommitted files on your server.
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 characters
#!/bin/bash | |
# Run git status on every git repository under the given directory. | |
# (see also: https://gist.github.com/mzabriskie/6631607) | |
# | |
# USAGE: bash git_status_recursive.sh <DIRECTORY_PATH> | |
# | |
# EXAMPLE1: bash git_status_recursive.sh /home/thorgeir | |
# EXAMPLE2: bash git_status_recursive.sh . | |
# | |
# DATE: Wed Jun 10 18:15:35 UTC 2020 | |
DIRECTORY_PATH=${1}; | |
for path in $(find ${DIRECTORY_PATH} -type d -name ".git" 2>/dev/null); do | |
pushd $(dirname ${path}) > /dev/null; | |
(set -x; git status -s $PWD); | |
popd > /dev/null; | |
done | |
# Example output: | |
# + git status -s /home/thorgeir/github/thorgeir/linux_configs | |
# M st_terminal_config.h | |
# + git status -s /home/thorgeir/github/thorgeir/utils | |
# + git status -s /home/thorgeir/github/thorgeir/calendar_icelandic | |
# ?? cal_is/test_cal_is.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment