當前git卡在一個循環中。由於本地更改,它無法合併。我無法隱藏本地更改,因爲找不到任何更改。如何讓git覆蓋未知的本地更改?
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$ git pull
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 3), reused 0 (delta 0)
Unpacking objects: 100% (5/5), done.
From https://private/url/project/
e56777c..fac7619 master -> origin/master
Updating e56777c..fac7619
error: Your local changes to the following files would be overwritten by merge:
ProjectSettings/EditorBuildSettings.asset
Please, commit your changes or stash them before you can merge.
Aborting
$ git status
On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working directory clean
$ git pull
Updating e56777c..fac7619
error: Your local changes to the following files would be overwritten by merge:
ProjectSettings/EditorBuildSettings.asset
Please, commit your changes or stash them before you can merge.
Aborting
$ git stash
No local changes to save
$ git fetch
$ git status
On branch master
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
(use "git pull" to update your local branch)
nothing to commit, working directory clean
$ git stash
No local changes to save
$ git merge
Updating e56777c..fac7619
error: Your local changes to the following files would be overwritten by merge:
ProjectSettings/EditorBuildSettings.asset
Please, commit your changes or stash them before you can merge.
Aborting
$ git stash
No local changes to save
試着在this question上接受的答案,不起作用。我得到以下錯誤:
$ git fetch --all
Fetching origin
$ git reset --hard origin/master
error: Entry 'ProjectSettings/EditorBuildSettings.asset' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'origin/master'.
有人能夠可靠地reproduce and fix the last error:「無法重指數...」,但他們建議的解決方法會產生下列錯誤對我來說:
$ git add .
$ git reset --merge fac7619
error: Entry 'ProjectSettings/EditorBuildSettings.asset' not uptodate. Cannot merge.
fatal: Could not reset index file to revision 'fac7619'.
是無論如何強迫git覆蓋ProjectSettings?或者詢問它爲什麼認爲沒有發現任何東西時會發生局部變化?
編輯:
好,做reset --merge
後,我做了reset --hard
然後git status
通知我,我是落後1提交,這個時候,我做的一切git pull
合併沒有問題。
那麼,如何避免上述情況呢? 或者這對於多操作系統環境來說很常見?
我的工作流程相當一致。我從拉開始,進行編輯,添加,提交和推送。但是,對於這個項目,有時候我在一臺Windows機器上,而另一些人則在使用OSX。在使用git的兩年中,我只是沒有遇到這個問題。
你解決衝突?該文件被忽略? 'git status --ignored'的輸出是什麼? –
'的分支主 \t彙編CSHARP-主編vs.csproj \t彙編CSHARP-Editor.csproj \t彙編CSHARP-Editor.sln \t彙編CSHARP-Editor.userprefs \t彙編CSHARP-VS .csproj的 \t大會-CSHARP-vs.sln \t大會-CSHARP-vs.userprefs \t彙編CSharp.csproj \t彙編CSharp.sln \t彙編CSharp.userprefs \t彙編UnityScript -vs.unityproj \t Assembly-UnityScript。unityproj \t庫/ \t STVE-csharp.sln \t STVE.sln \t STVE.userprefs 什麼承諾,工作目錄clean' – dval
也許解決衝突是另一個問題?它不會告訴我有任何衝突,因爲它找不到本地更改。我在考慮花費30分鐘的時間,只是刪除本地文件並重新複製遠程文件可能會更簡單。 – dval