Git Status Across Multiple Repositories on a Mac

后端 未结 11 2187
情歌与酒
情歌与酒 2020-12-05 14:47

I have been searching for a solution to this for a while and have not found quite what I need.

I have several Git Repositories in a folder on my Mac (OSX 10.6) and

11条回答
  •  温柔的废话
    2020-12-05 15:32

    It seems that the question has been answered fine, but I wanted to throw in my two cents after working on the same thing.

    I went closer to jcordasc's answer by using a simple bash script. I just did one thing a little different. Looking at the help docs for git you can set the git directory and working directory. This eliminates the need to 'cd' to the directories. Not that it really makes that much difference...

    #!/bin/bash
    
    for gitdir in `find ./ -name .git`; 
        do 
            workdir=${gitdir%/*}; 
            echo; 
            echo $workdir; 
            git --git-dir=$gitdir --work-tree=$workdir status; 
        done
    

    Obviously his is more advanced/cleaner for how it shows the status'...

提交回复
热议问题