git error: The following untracked working tree files would be overwritten by checkout

Git resolves an error: The following untracked working tree files would be overwritten by checkout
December 27, 2017 12:09:50
Reading count: 1,792
When switching branches in IDEA, such an error occurred, resulting in The failure to switch properly: error: The following untracked working tree files would be overwritten by checkout
According to the error message, the problem is caused by some untracked working tree files. So just solving these untracked files solves this problem.
Solutions:
Open SourceTree through the command line, enter the local version warehouse directory, directly executed

git clean -d -fx

Can. Git clean-d-fx means: delete files that don’t have Git add; git clean-fx means: delete files that don’t have Git add.
Git clean parameters
-n displays files and directories to be deleted;
-x – Deleting ignored files is no longer recognized by Git
-D — Deletes files that have not been added to Git’s path
— F — Forced operation
Git clean – n
Git clean – df
Git clean – f

Read More: