LoginSignup
0
0

Git error: you need to resolve your current index first

Posted at

何してたかって?

自分が作業してたブランチの作業をテスト用のブランチに諸事情でマージじゃなくてCherry-pickで持ってこようとしたんですよ。
そしたら元にしたブランチが少し古くて
CONFLICT (content): Merge conflict in ファイル名
error: could not apply コミット名
と出てしまいまして。

Mergeするにもその同僚が休暇中だったので、だったらいったん自分のコミットRevertして、同僚のコミット取り込んでからまた編集しようと思ったんですよ。
なのでいったん自分が作業してたブランチに戻ろうとしたんですね。そしたら
error: you need to resolve your current index first
競合ファイル名: needs merge
ふーむ

まずはgit cherry-pick --abort

error: no cherry-pick or revert in progress
fatal: cherry-pick failed
ほーう

ググるとgit merge --abortが魔法の呪文らしい

さっそく実行
fatal: There is no merge to abort (MERGE_HEAD missing).
おーん

たどり着いたのが

git reset --merge
どうやら
needs merge
error: you need to resolve your current index first
が一緒に出てるときはmergeをgit resetするのがよろしいようで
以下参照
https://stackoverflow.com/questions/6006737/git-merge-errors

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0