今天提交代碼出現(xiàn)以下現(xiàn)象:
admin:ios-hybird-flutter Red$ git add .
admin:ios-hybird-flutter Red$ git st
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: FlutterBoostDemo/.gitignore
new file: FlutterBoostDemo/.metadata
new file: FlutterBoostDemo/FlutterBoostDemo.iml
new file: FlutterBoostDemo/FlutterBoostDemo_android.iml
new file: FlutterBoostDemo/README.md
new file: FlutterBoostDemo/lib/FirstPage.dart
new file: FlutterBoostDemo/lib/main.dart
new file: FlutterBoostDemo/pubspec.lock
new file: FlutterBoostDemo/pubspec.yaml
new file: FlutterBoostDemo/test/widget_test.dart
new file: SwiftDemo
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: SwiftDemo (modified content, untracked content)
問題:
modified: SwiftDemo (modified content, untracked content)
SwiftDemo目錄沒有被跟蹤术唬,嘗試幾次都沒有add上去薪伏,從SourceTree上看SwiftDemo只是一個空目錄,目錄下的文件沒有加進去粗仓。
解決辦法:
SwiftDemo目錄里有一個.git目錄嫁怀,就是說SwiftDemo本身也是一個代碼庫。
admin:SwiftDemo Red$ rm -rf .git
刪除.git目錄后借浊,git add . 還是不行塘淑。
最后把SwiftDemo目錄移動到其它目錄,再移回去蚂斤,git add . 正常存捺。