Skip to content

Instantly share code, notes, and snippets.

@Dylancyclone
Last active January 3, 2023 22:46
Show Gist options
  • Save Dylancyclone/f53bd09eed37b3bdfd451e44913a001c to your computer and use it in GitHub Desktop.
Save Dylancyclone/f53bd09eed37b3bdfd451e44913a001c to your computer and use it in GitHub Desktop.
Display git repo info on browse using `o2sh/onefetch`
LAST_REPO=""
cd() { builtin cd "$@" git rev-parse 2>/dev/null
if [ $? -eq 0 ]; then
if [ "$LAST_REPO" != $(basename $(git rev-parse --show-toplevel)) ]; then
onefetch
LAST_REPO=$(basename $(git rev-parse --show-toplevel))
fi
fi
}
@thehale
Copy link

thehale commented Jan 3, 2023

For usage with onefetch to see git repo information on the command line

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