使用git上傳代碼時 出現錯誤:
error: The following untracked working tree files would be overwritten by merge:
gifts/.DS_Store
Please move or remove them before you can merge.
Aborting
使用 git clean -d -fx? 即可解決
執行后:
Removing .DS_Store
Removing gifts/.DS_Store
Removing gifts/gifts/.DS_Store
Removing gifts/gifts/Navigation/.DS_Store
Removing gifts/gifts/Navigation/DateSource/.DS_Store
Removing gifts/gifts/Navigation/Pictures/.DS_Store
將目錄下的.DS_Store文件全部刪除;
不過使用?git clean -d -fx時需要注意 會刪除掉沒有add到倉庫的文檔 大家要謹慎操作!!!
執行 git add .時出現錯誤:
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
解決方案:
rm -f ./.git/index.lock
git 版本回退:
git reflog
git reset --hard