Here are some instructions on how to use it:
- Save the snippet below to a file and name it something like multipleStatus.sh;
- Place the file on the same folder of your repositories;
- To run the script, browse to that folder and type:
source multipleStatus.sh; find-dirty
And here is the snippet you need to save:
#!/bin/bash function unstaged_changes() { worktree=${1%/*}; git --git-dir="$1" --work-tree="$worktree" diff-files --quiet --ignore-submodules -- } function uncommited_changes() { worktree=${1%/*}; git --git-dir="$1" --work-tree="$worktree" diff-index --cached --quiet HEAD --ignore-submodules -- } function find-dirty () { for gitdir in `find . -name .git`; do worktree=${gitdir%/*}; if ! unstaged_changes $gitdir then echo "unstaged $gitdir" fi if ! uncommited_changes $gitdir then echo "uncommitted $gitdir" fi done }
No comments:
Post a Comment