[Development] How to use `init-repository` properly to clean up the working tree after checking out?

Thiago Macieira thiago.macieira at intel.com
Sun Aug 20 20:48:05 CEST 2023


On Sunday, 20 August 2023 10:41:37 PDT Haowei Hsu wrote:
> However, I found that even after I run *`perl init-repository -f`* and then
> running *`git status`*
> again, the working tree is still not clean.

Use "git submodule update --recursive" instead

> Currently, whenever I check out to another branch/tag, I use the following
> two commands to
> clean up the working tree:
> 
>    1. *git submodule update --recursive *
>    2. *git clean -xfdf && git submodule foreach --recursive git clean -xfdf*

Like that. The git clean shouldn't be necessary if you build each module 
individually and thus don't build what you don't need. Do not build the top 
dir unless you're prepared to fix the issues.

> 6. *git status*
> 
> You can see the attachment with the full log:
> *log-my-approach-to-clean-up.txt*
> 
> [image: image.png]
> 
> As we can see, my approach seems not able to clean up the working tree in
> this situation as well.

(I can't see anything because you're taking screenshots of text)

If you want to fix the issues, go into those dirs, do a git status and find out 
why Git thinks they're unclean compared to what the submodule link says they 
should be at. Then take action.

> Therefore, I'd like to ask:
> *how to use `init-repository` properly to clean up the working tree after
> checking out?*

You don't. The tool is not designed for that.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Cloud Software Architect - Intel DCAI Cloud Engineering
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5152 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20230820/396334ee/attachment.bin>


More information about the Development mailing list