Created
February 3, 2022 14:38
-
-
Save weeble/3f511ab145e93a33177cf9c6542b9460 to your computer and use it in GitHub Desktop.
Short shell script to run a command at the top level directory of a git repo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if toplevel="$(git rev-parse --show-toplevel)" | |
then | |
if cd "$toplevel" | |
then | |
exec "$@" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment