Zeth Zeth - 2 years ago 90
Git Question

Search computer for all .git-folder with uncommited changes

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

-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:

| |-.git # containing uncommitted changes
| |-index.php
| |-page_one.php
| |-.git # This git-status is clean
| |-index.php
| |-another_page.php
| |-.git # containing unstaged changes
| |-index.php
| |-some_page.php
| |-.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