我经常想检查发生了什么,特别是我想要一个命令,该命令列出了所有已更改的子文件夹的输出。有人知道解决方案吗? (顺便说一下,我在Mac OSX上)。
如果您需要递归(如果不这样做,也会工作):
git status
对于每个名称的目录.git
git status
)。哇,正是你想要的。
您也可以附加
-execdir
,以免在GIT项目的子目录中进一步提高效率(但可能会跳过Git subsodules,我没有想法,我没有想法,我从未使用过它们):-prune
在每个目录上介绍,并分别使用Commandline选项
find . -name .git -type d -execdir git status \; -prune
和
.git
设置工作目录和--work-tree
目录:--git-dir
for x in *; do git --work-tree="$x" --git-dir="$x/.git" status; done
Where:
**/*= subdiretory中的每个文件* = root diretory中的每个文件
这就是我的个人资料中所拥有的,我经常使用它。
git status **/* *
gitr () {
for f in $(find . -type d -name .git | awk -F"/.git$" '{print $1}'); do
echo
echo "................................ (cd $f && git $*) ........................................."
echo
(cd $f && git $*)
done
}
. gitr.sh # file containing gitr() function, if not in a profile file
我得到了类似的东西:
gitr status
or
................................ (cd ./dir0 && git status) .........................................
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
................................ (cd ./dir1 && git status) .........................................
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
................................ (cd ./dir2 && git status) .........................................
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
................................ (cd . && git status) .........................................
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
or
gitr log -c 1
gitr rev-parse --abbrev-ref HEAD
它递归起作用。您可以为您的要求更改
find . -maxdepth 1 -mindepth 1 -type d -exec sh -c '(echo {} && cd {} && git status -s && echo)' \;
和
maxdepth
该代码将为子目录提供一个名称并显示紧凑的状态:
mindepth
您可以创建一个脚本。也许也只是将其作为函数和位置创建。
ls | xargs -i sh -c 'echo _______ {} ______ && cd {} && git status -s -uno && cd .. '
将其放在主文件夹中并运行
.bash_profile
如果您的存储库是统一的,您可以做一些事情:#!/bin/bash
REPOS=(GitRepoA GitRepoB GitRepoC AnotherRepoA)
for R in "${REPOS[@]}"; do
echo "Checking repo $R."
pushd "$R" >/dev/null && {
git status
popd >/dev/null
}
done
或也许只是
bash script_name.sh
仅作为功能:shopt -s nullglob
REPOS=(GitRepo{A..Z} AnotherRepoA)
i通过编写shell脚本
Mgit来处理此内容,该脚本读取了当前目录中的隐藏文件.mgit,其中包含单个git存储库的文件夹列表。它做类似的事情:
shopt -s nullglob
REPOS=(*)
trory git状态-u all。
这将列出所有修改和未跟踪的文件,直到所有子文件夹的叶节点保持基本根为当前工作目录