简体   繁体   中英

What can cause git rebase to see conflicts while there are none?

My feature branch "feature/my-branch" was branched out from "version/1" branch. Now, a "version/2" branch is created, that is branched out from "version/1" that had some commits after me branching out the feature branch.

I want to merge "feature/my-branch" to "version/2" branch. To do it I use:

git rebase version/2

There are no conflicts between my branch and "version/2" branch. But still I have to go through all commits:

  • Accept all current changes in all files changed by particular commit

  • Save all files

  • I have to execute:

     git add -A
  • And then continue to next commit:

     git rebase --continue

There are no conflicts, but git rebase wants to go through all commits every time. So I have to accept each and every change in every commit that was made in-between. It seems it should not work that way.

How to fix it?

Your best solution is on branch two to squash all of your commits.

Then rebase off of 1. This will simplify the merge.

I've had similar issues but that were caused by some local commit in my branch being in conflict but I know I fixed it in a later commit but trying to track through multiple commits on a branch is a nightmare.

Squash your branch and then it should remove the pain of figuring out what its btchng about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM