2017-02-19 83 views
0

我所問的問題只是對我來說一個很大難題的第三步。Git - 提交失敗,出現錯誤:分支是最新的,但實際上有更改要提交

  1. 所有的開始與.gitignore文件不工作。 我搜索了一下,發現在我的回購的頂部文件夾中輸入git rm -r --cached .,然後在編輯我的.gitignore文件並提交一切應該已經工作後git add .
  2. 但是,當試圖提交我收到了提交錯誤的一切(以及隨之而來的失敗)消息,由於警告:

    LF will be replaced by CRLF

    我還是那句話一派,:檢查是否core.autocrlf是真實的(它是)並試圖讓警告消失git congif --global core.safecrlf false

這使我的第三和最後一步

  • 當我想最後提交我的.gitignore更改我的回購協議,我從IDE收到:

    Commit failed with error 0 files committed, 1462 files failed to commit: Fixes .gitignore

    On branch develop Your branch is up-to-date with 'origin/develop'. nothing to commit, working directory clean

  • 這一點,不過,我從git status爲我所有的1462個文件獲得:

    On branch develop

    Your branch is up-to-date with 'origin/develop'.

    Changes to be committed: (use "git reset HEAD ..." to unstage)

    deleted: .idea/vcs.xml
    modified: app/.gitignore
    deleted: app/app.iml
    deleted: app/build/generated/source/buildConfig/androidTest/debug/com/android_ application/adiuvapp_verbalatina/test/BuildConfig.java

    我認爲在這一點上,我應該使用git reset HEAD...,但我真的不想搞亂任何東西!

    我該如何解決這個問題?

    +1

    因此,對於第3步,你提交從android工作室的變化?如果你從git bash提交更改會怎麼樣? –

    +0

    它實際上解決了問題!沒有嘗試過這種解決方案,我感到非常愚蠢。 發表您的評論作爲答案!你能解釋一下爲什麼它以這種方式工作嗎? –

    +0

    是的,我剛纔添加了一個答案,並解釋了原因。 –

    回答

    1

    對於step3,你可以嘗試在git bash中使用git commit而不是android studio。

    因爲git bash是比其他IDE集成git更原始和更全面的功能,並且您做了一些更改來阻止某些文件被git控制(該功能未在android studio中使用),所以它無法很好地檢測到這些變化。

    0

    只是一個猜測,可能會有所幫助,請嘗試「git add .gitignore」然後提交。

    +0

    文件.gitignore已經提交。我只編輯它,我想讓git識別我的更改... –