A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://stackoverflow.com/questions/28569923/git-clean-with-gitpython below:

python - git-clean with GitPython

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.

asked Feb 17, 2015 at 19:50

PaddrePaddre

82811 gold badge1010 silver badges2020 bronze badges

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")

answered Feb 17, 2015 at 19:58

Marcus MüllerMarcus Müller

36.7k44 gold badges5858 silver badges104104 bronze badges

3

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4