Skip to content

Instantly share code, notes, and snippets.

@vipero07
Created October 18, 2023 13:53
Show Gist options
  • Save vipero07/9287af445a011656c0bcd2b81133bd58 to your computer and use it in GitHub Desktop.
Save vipero07/9287af445a011656c0bcd2b81133bd58 to your computer and use it in GitHub Desktop.
git all alias for .gitconfig - runs git command on all subdirectories
[alias]
all = "!f() { ls -R --directory --color=never */.git | sed 's/\\/.git//' | xargs -P10 -I{} git -C {} $1; }; f"
@vipero07
Copy link
Author

This will make the git alias of git all which applies a git command to all sub folders you can follow it with any normal git command e.g.

git all pull

When run in a project directory will pull all the children directories.

stateDiagram-v2
        State1: Parent Directory
        note right of State1
            Run `git all pull` here
        end note
        State1 --> Child
        State1 --> Child2
        State1 --> Child3

All children folders will have git pull run inside

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment