Skip to content

Instantly share code, notes, and snippets.

@colstrom
Created December 9, 2016 20:36
Show Gist options
  • Select an option

  • Save colstrom/f31c99a55f80015537d9e397a96b9427 to your computer and use it in GitHub Desktop.

Select an option

Save colstrom/f31c99a55f80015537d9e397a96b9427 to your computer and use it in GitHub Desktop.
directory-in-git.fish: check if a directory is or is in a git repository
function directory-in-git --argument dir
git -C "$dir" rev-parse --is-inside-working-tree >/dev/null ^/dev/null
status-to-bool $status
end
name = directory-in-git
author = Chris Olstrom
license = MIT
provides = fish/functions/directory-in-git
requires
command/git
fish/builtin/end
fish/builtin/function
fish/functions/status-to-bool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment