Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Quick status on all git repos in a directory. Based on this answer: https://unix.stackexchange.com/a/394245/63051
# Run the following from a directory containing multiple git repositories
# The `28` in the printf command is arbitrary and just matches the number of characters in the longest-named repo I have.
function repo_states () {
for repo in */; do
printf '%-28s' "$repo"
( cd "$repo" && git status --short --branch --untracked-files=no )
done
}
@DaneWeber
Copy link
Author

Example output (local branch in green and origin branch in red):

enr-lobster-roll/           ## master...origin/master
signatory-rails-app/        ## master...origin/master
abc-cases-business/         ## point-to-abc-cases-data
abc-cases-data/             ## expand-case-header-all-query...origin/expand-case-header-all-query
abc-cases-read/             ## master...origin/master
abc-cases-ui/               ## master...origin/master [behind 1]
abc-documentation/          ## master...origin/master
abc-metrics/                ## master...origin/master
abc-utilities/              ## master...origin/master
xyz-signatory-api/          ## master...origin/master
xyz-local-data-services/    ## master...origin/master
xyz-oracle-local-loader/    ## master...origin/master

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