1. 程式人生 > >git解決error: The following untracked working tree files would be overwritten by checkout

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

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

2017年12月27日 12:09:50

閱讀數:1792

在IDEA中進行分支切換時,出現如此錯誤,導致無法正常切換:error: The following untracked working tree files would be overwritten by checkout

通過錯誤提示可知,是由於一些untracked working tree files引起的問題。所以只要解決了這些untracked的檔案就能解決這個問題。

    解決方式:

    開啟SourceTree通過命令列,進入本地版本倉庫目錄下,直接執行

 

git clean -d -fx

即可。可能很多人都不明白-d,-fx到底是啥意思,其實git clean -d -fx表示:刪除 一些 沒有 git add 的 檔案;

    git clean 引數 

    -n 顯示將要刪除的檔案和目錄;

    -x -----刪除忽略檔案已經對git來說不識別的檔案

    -d -----刪除未被新增到git的路徑中的檔案

    -f -----強制執行

    git clean -n

    git clean -df

    git clean -f