web-dev-qa-db-ja.com

Git:Gitとの問題のマージ

私は使っている git version 1.7.11.msysgit.0

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

後で、GIT Clientをインストールし、サーバーのコンテンツをマシンに取得するためにクローンを作成しました。

次に、ローカルマシンの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'.

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

21
Pawan

これを行う:

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
25
wadesworld

試してください:

 git reset README.md

私は同様の問題を抱えていましたが、これがそれを解決した唯一の問題でした。

9
dorien

git resetは良い解決策です。警告メッセージの形式が改善されました(Git 2.1、2014年8月)

commit d795216 および commit 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.
3
VonC