Completely clean Git Qt sources

  • Hello,

    Is there a way to completely clean the Qt sources so that they are exactly the same as directly after cloning them from the Qt Git repository?

    I tried "git submodule foreach --recursive "git clean -dfx"" but there are still some new files there (generates by Visual Studio nmake/jom).


  • Lifetime Qt Champion


    IIRC, it's git clean -dffx. Using f twice, git will remove everything that is not part of the original repository including folder containing .git subdirectories or file.

  • Although this command seems to clean all files I still have to re-clone (or extract from a clean backup) the git archive to get a clean environment for configure. I have no clue why (even a system reboot does not fix the problem).

  • Lifetime Qt Champion

    Are you doing in sources builds ? If so, you should change to out of sources builds. This will allow you to keep the sources clean and also start from scratch more easily.

  • No, I do out of the source tree builds. The following produces problems:

    1.) configure -xplatform winrt-arm-msvc2015
    2.) Clean local repository
    3.) Open new command prompt
    4.) configure -xplatform winrt-x86-msvc2015

    Configure in Step 4 fails.

    This works:
    1.) configure -xplatform winrt-arm-msvc2015
    2.) Delete local repository and clone again.
    3.) Open new command prompt
    4.) configure -xplatform winrt-x86-msvc2015

  • Qt Champions 2018

    @PS76 said in Completely clean Git Qt sources:

    2.) Clean local repository

    You should do a git status afterwards in the toplevel git directory. If any of the subdirectory shows modified or dirty, you can repeat it there.

    This should really show what stays in these directories after cleaning.

    I think your problem is, that the call:

    "git submodule foreach --recursive "git clean -dfx""

    should be followed by a git clean -dfx for the top-level directory.


  • @aha_1980 Thanks - the second git clean step did the trick.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.