34

使ってますgit version 1.7.11.msysgit.0

GitHUBの下にリポジトリを作成し、テキストコンテンツを含むREADME.mdというファイルを追加しました。

後で、GITクライアントをインストールし、サーバーの内容を自分のマシンに取り込むためにクローンを作成しました。

次に、ファイルREADME.mdをローカルマシンに削除しました。

git commitを実行すると、このエラーが発生します

praveenk@MSIN-BT-100 /d/workspace/MYTestRepo (master|MERGING)
$ git commit ;
U       README.md
error: 'commit' is not possible because you have unmerged files.
hint: Fix them up in the work tree,
hint: and then use 'git add/rm <file>' as
hint: appropriate to mark resolution and make a commit,
hint: or use 'git commit -a'.
fatal: Exiting because of an unresolved conflict.

これはとgit pullです:

$ git pull;
U       README.md
A       One.txt
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

これらのエラーを解決する方法は?

4

4 に答える 4

44

これを行う:

git merge --abort
git pull (to be sure you're up-to-date)

ここで、README.md ファイルの内容を必要な内容に置き換えます。まったく必要ない場合は、git rm README.md を実行してください。

次に、コンテンツを置き換えた場合は、それらのコンテンツをコミットしてプッシュします。

git add README.md
git commit -m "comment"
git push
于 2012-07-17T18:57:03.867 に答える
3

git reset良い解決策ですが、警告メッセージの形式が改善されたことに注意してください (Git 2.1、2014 年 8 月)

commit d795216commit c057b24 by Jeff King ( peff)を参照してください。

不規則な行の折り返しにより、これは読みにくくなり、必要以上に多くの行が必要になります。代わりに、1 行あたり約 60 文字にラップし直しましょう。
" " を囲む引用符commitは不格好です。ユーザーは、このメッセージがコマンド名が入力されたテンプレートであることを気にしません。

$ git commit
U       foo
error: commit is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit, or use
hint: 'git commit -a'.
fatal: Exiting because of an unresolved conflict.
于 2014-08-02T17:53:38.833 に答える