Zeth Zeth - 1 year ago 66
Git Question

Search computer for all .git-folder with uncommited changes

I have several project-folders on my machine, all including a

.git
-directory. I assume that all programmers have been in the situation, where they've forgotten to push something to the server. So is there a way to search all subdirectories for uncommitted/unstaged changes and list them?

Here is an example of my situation:

MainFolder
|
|-Project1
| |-.git # containing uncommitted changes
| |-index.php
| |-page_one.php
|
|-Project2
| |-.git # This git-status is clean
| |-index.php
| |-another_page.php
|
|-Project3
| |-.git # containing unstaged changes
| |-index.php
| |-some_page.php
|
|-Project4
| |-.git # containing uncommited changes
| |-index.php
| |-some_page.php


I'd like a list, say:

You need to check these .git-files:
- MainFolder/Project1/.git
- MainFolder/Project3/.git
- MainFolder/Project4/.git

Answer Source

Does find do what you want?

find MainFolder -name .git -print -execdir git status \;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download