About
As PX4-Autopilot has ~18 submodules (and even more, if you count the submodules inside the submodule), quite often when you switch branches you will encounter errors like this:
And as shown above, removing each of the “Untracked files” (which are the submodules that used to exist in the branch you switched from, but don’t exist anymore in the new branch) is quite tedious and annoying! What can we do about this?
Solution
Well you may first think that git clean -fd
(Remove untracked files forcefully, including directories) will do the job, but that’s not the case. So what is the solution?
In fact, this is a common frustration/problem for projects with large number of submodules.
Special script to parse out Untracked files
First solution is to
Special script to de-initialize and re-initialize submodules
In the end, this ‘untracked submodule’ problem occurs because each branch has its own set of submodules defined and this changes.
Satisfied?
TODO- Finish the article, as I am not sure yet how to solve it completely neither