Git Status Across Multiple Repositories on a Mac

后端 未结 11 2201
情歌与酒
情歌与酒 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:25

    @oxtay 's answer is the prettiest, so I've modified it to make it even prettier: https://github.com/Flurrywinde/Git-Status

    I also fixed some bugs and made it work even with some messed up repos that caused @Ferry Boender's to throw errors:

    ./git-ftp: ok 
    ./kphotoalbum: ls: cannot access './kphotoalbum/.git/refs/heads': No such file or directory
    fatal: Not a git repository: './kphotoalbum/.git'
    fatal: Not a git repository: './kphotoalbum/.git'
    fatal: Not a git repository: './kphotoalbum/.git'
    Uncommitted changes 
    ./SemanticForms: Uncommitted changes 
    ./git-big-picture: Uncommitted changes Untracked files 
    ./10-minute-vim-exercises: ok 
    ./moviemasher: Uncommitted changes 
    ./tumbdlwtf: Uncommitted changes 
    ./rotatezoomHTML5video: Uncommitted changes 
    ./tumbdl: Needs push (master) 
    .: ls: cannot access './python/refs/heads': No such file or directory
    fatal: Not a git repository: './python'
    fatal: Not a git repository: './python'
    fatal: Not a git repository: './python'
    Uncommitted changes 
    .: ls: cannot access 'mediawiki/refs/heads': No such file or directory
    fatal: Not a git repository: 'mediawiki'
    fatal: Not a git repository: 'mediawiki'
    fatal: Not a git repository: 'mediawiki'
    Uncommitted changes 
    parser: ls: cannot access 'parser/.git/refs/heads': No such file or directory
    fatal: Not a git repository: 'parser/.git'
    fatal: Not a git repository: 'parser/.git'
    fatal: Not a git repository: 'parser/.git'
    Uncommitted changes 
    ./gundo.orig: Uncommitted changes 
    ./wikiteam: Uncommitted changes Untracked files
    

    @Nathan's ruby one seems to have a bug, giving an [ERROR] when the repo is fine:

    $ git status-all
    yourls-popular-clicks-extended                                                     [ERROR]
    undefined local variable or method `s' for "yourls-popular-clicks-extended":String
    miniProxy                                                                         [master]
    dmenu-4.6-kanon          M15U37                                                   [master]
    freeCodeCamp                                                                       [ERROR]
    undefined method `up_to_date?' for nil:NilClass
    
    $ mgitstatus                       
    ./yourls-popular-clicks-extended: ok 
    ./miniProxy: ok 
    ./dmenu-4.6-kanon: Uncommitted changes Untracked files 
    ./freeCodeCamp: Untracked files
    

    Notice how it says [ERROR] for yourls-popular-clicks-extended and freeCodeCamp. Mine and Ferry's get it right.

    Mine also retains its colors if run as a sub-process of watch, which makes it convenient to be cleaning up your repos and see each one get ticked off in real-time.

    Screenshot of mine in a tmux session where I'm cleaning up the repos

提交回复
热议问题