Is there any way to do something like git clean -d -x -f
using GitPython?
I need to reset working directories and want to get rid of all unversioned files without deleting the whole folder (except for .git
) and checking out again.
You can work around by using the git
command directly, from gitpython
More complete example:
import git
repo = git.Repo("/path/to/repo")
repo.git.clean("-xdf")