Skip to content

Instantly share code, notes, and snippets.

@DaneWeber
Created September 28, 2017 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaneWeber/5ae74e964718f75f29594cde87bc9200 to your computer and use it in GitHub Desktop.
Save DaneWeber/5ae74e964718f75f29594cde87bc9200 to your computer and use it in GitHub Desktop.
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