Last active
June 24, 2020 14:06
-
-
Save k-nakamura/4bc204e0433d1e1caf1c6f8fcffff6f8 to your computer and use it in GitHub Desktop.
git quick viewer bellow current directory
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/sh | |
work_dir=$(pwd) | |
for git_dir in $(find . -name .git); do | |
src_dir=$(dirname $git_dir) | |
cd $src_dir | |
echo $src_dir | |
# check git repository | |
git rev-parse --git-dir > /dev/null 2>&1 | |
ret=$? | |
if [ $ret != 0 ]; then | |
# not a git repository(e.g. submodule) | |
echo "Not a git repository" | |
else | |
git rev-parse --abbrev-ref HEAD | |
git log -1 --no-merges --oneline | |
fi | |
echo "==============================" | |
cd $work_dir | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment