Skip to content

Instantly share code, notes, and snippets.

@mhanberg
Created May 22, 2020 15:05
Show Gist options
  • Select an option

  • Save mhanberg/038775b44e786ac29de09a8bda3a7ba5 to your computer and use it in GitHub Desktop.

Select an option

Save mhanberg/038775b44e786ac29de09a8bda3a7ba5 to your computer and use it in GitHub Desktop.
# cd into every dir in my ~/Development folder
# determine if a repo is from my work's GitHub org
# set my git user email with my work email
# cd back out
for dir in $(ls); do
cd "$dir"
is_work=$(git remote get-url --push origin | awk '/[email protected]:github-org\//{print 1}')
if [ -n "$is_work" ]; then
git config user.email "[email protected]"
fi
cd ..
done
@mhanberg
Copy link
Author

mhanberg commented Jun 3, 2020

This doesn't seem to work if the directory name has a space it.

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