Problem Description:

When merging a developed feature branch into a master branch, we did a rebase because the code was a bit old. The result is that there are so many conflicting projects that you skip all the commits that can be skipped by default (graphical Git tools). After resolving a bunch of conflicts, you realize that part of your commit is missing.

Solution:

  1. Enter on the command linegit reflog, the missing COMMIT information column appears
  2. Find the commit rows you need,git checkout -b recovery q1dw23d
  3. git checkout master git merge recoveryCut back to the main branch

Reflection:

  1. carefulgit rebase -skip
  2. Take notes when you commit. A feature branch that fixes bugs after testing, or enhances, each commit to enhance balabala… As a result, it took quite a while to find a commit
  3. Git usually leaves a trail of things that have been committed.
  4. This operation is also useful for retrieving branches that have mistakenly deleted local commits but have not been pushed to remote locations

I referred to Jane’s article when SOLVING the problem. Thank you.