Skip to content

Instantly share code, notes, and snippets.

@paddy74
Last active October 26, 2020 21:10
Show Gist options
  • Save paddy74/8e98221210aea2156b01a988cc497599 to your computer and use it in GitHub Desktop.
Save paddy74/8e98221210aea2156b01a988cc497599 to your computer and use it in GitHub Desktop.
Clean the current git repository of ignored files
#!/bin/bash
if git tag > /dev/null 2>&1 && [ $? -eq 0 ]; then
git rm -r --cached .
git clean -dfX
git add .
else
echo "fatal: not a git repository (or any of the parent directories): .git";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment