Skip to content

Instantly share code, notes, and snippets.

@PuZZleDucK
Created July 23, 2017 05:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save PuZZleDucK/a45fd1fac3758235ffed9fe0e8aab643 to your computer and use it in GitHub Desktop.
Save PuZZleDucK/a45fd1fac3758235ffed9fe0e8aab643 to your computer and use it in GitHub Desktop.
Script to wrap the `linguist` command so it can be used on non-repositories
echo "Local Linguist (linguist for non repos)"
if git status 2> /dev/null > /dev/null; then
echo "!!! This directory is already a git repository... please use the 'linguist' command instead"
echo "!!! If this command exits unclean it will leave a git repository behind"
echo "!!! You can remove the git repository by running 'rm -Rf .git'"
else
git init 2> /dev/null > /dev/null
git add --all 2> /dev/null > /dev/null
git commit -m "local linguist auto commit" 2> /dev/null > /dev/null
linguist "$@"
rm -Rf .git 2> /dev/null > /dev/null
fi
@balaprasathr
Copy link

The following should go between line 8 and 9 to execute without error.

git config user.name "githubtest"

This totally worked. Thanks for the script.

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