Skip to content

Instantly share code, notes, and snippets.

@weeble
Created Feb 3, 2022
Embed
What would you like to do?
Short shell script to run a command at the top level directory of a git repo
#!/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