15

devel ブランチから master へのマージ スカッシュを実行しようとしています。

stefanos-imac:trunk borini$ git merge --squash devel
CONFLICT (content): Merge conflict in test1
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 2224 and retry the command.
Squash commit -- not updating HEAD
Automatic merge failed; fix conflicts and then commit the result.

けっこうだ。

stefanos-imac:trunk borini$ git config merge.renameLimit 999999

次に、マージを元に戻し、より高い制限でやり直します

stefanos-imac:trunk borini$ git merge --abort
fatal: There is no merge to abort (MERGE_HEAD missing).

わかりました。おそらく、それが示すように実行し、マージ コマンドを再度呼び出す必要があります。

stefanos-imac:trunk borini$ git merge --squash devel
fatal: 'merge' 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 and make a commit, or use 'git commit -a'.

ああ、あなたはどうしてそんなに git なのですか?

もっと言えば、この状況から抜け出す方法を知っている人はいますか?

4

3 に答える 3

24

エム、git reset --hard origin/master?

于 2012-05-24T13:11:07.100 に答える
7

マージを元に戻す最新の方法は次のとおりです (ただし、これは MERGE_HEAD が存在する場合にのみ機能します)。

git merge --abort

そして、この場合に機能する少し古い方法 (MERGE_HEAD がありません):

git reset --merge

受け入れられた回答で説明されている昔ながらの方法(警告:ローカルの変更はすべて破棄されます):

git reset --hard

したがって、それは存在する与えられたものgit merge --abortとのみ同等であることに注意してください。これは、merge コマンドの git ヘルプで読むことができます。git reset --mergeMERGE_HEAD

git merge --abort is equivalent to git reset --merge when MERGE_HEAD is present.

マージが失敗した後、 がないMERGE_HEAD場合、失敗したマージは で取り消すことができますgit reset --mergeが、必ずしも を使用するとは限りませんgit merge --abort

于 2015-10-01T10:40:54.123 に答える
4

git merge --abortトリックも行います。完全な git reset コマンドを入力するよりも少し高速です。

rebaseAbort はおよびとも連携しcherry-pickます。

于 2014-03-12T02:11:30.423 に答える