fatal: Cannot do a soft reset in the middle of a merge.

環境

現象

※ 今回はSourceTreeで操作.

% git add -A
% git commit -m "xxx"
% git push origin develop
fatal: Cannot do a soft reset in the middle of a merge.
hint: Updates were rejected because the remote contains work that you do
hint:. not have locally This is usually caused by another repository pushing
hint:. to the same ref You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


解決法

以下の手順でgit pull --rebaseを行ってからcommitを再度行う.

  1. git commit
  2. git push
  3. git pull --rebase
  4. git commit
  5. git push