1

This is what I am doing:

1) I cut a new branch from master. 2) Make some changes and created pull request. Till now commit history is

02  second commit   
01  first commit 

3) During code review, reviewer asked me to replace tabs with spaces in xmls. I did it and push those changes.

03  Tabs removed in third commit    
02  second commit   
01  first commit 

4) Pull request is approved and goes to merge to master pipeline.

5) I keep rebasing with master until my M2M request is in queue which works fine.

6) During this parent pom version is updated.

I update parent version and push those changes. My push fails for a file where I updated parent version. The error message asks me to do git pull first

Auto-merging pom.xml
CONFLICT (add/add): Merge conflict in pom.xml

7) I resolve conflict and push those changes. Push is successful.

Now I do rebase with master and start getting rebase conflicts for all the xmls where I replaced tabs with spaces.

CONFLICT (content): Merge conflict in pom.xml
Patch failed at 01 first commit.

8) I resolve them by taking changes from origin/HEAD then git rebase --continue and then git rebase --skip.

9) Then I do rebase with master which shows upto date.

10) I do pull mybranch & I get a commit message Merge branch mybranch to mybranch. I enter commit message and then it shows merge made by 'recursive strategy'.

11) I try to do git push origin mybranch which is successful.

12) At this point my git commit history is like

13  Merge mybranch with mybranch    
12  child pom updated with parent version   
11  Tabs removed in third commit    
10  second commit   
09  first commit 
08  Merge (grayed)  
07  child pom updated with parent version   
06  Tabs removed in third commit    
05  second commit   
04  first commit 
03  Tabs removed in third commit    
02  second commit   
01  first commit 

13) Then I do git pull --rebase origin master and start getting merge conflicts again like previous. The rebase issues just keep on increasing.

This just goes on and I am stuck in a loop. Please help me to get rid of these issues with some explanation on what I am doing wrong. Also why do I keep getting space/tab issues for previous commit during rebase?

user1298426
  • 3,467
  • 15
  • 50
  • 96
  • 1
    First of all, _why_ are you rebasing here? Is your Git repo configured to allow fast forwards during pull requests? I don't follow everything you did, but most likely the problem is that you need to force push your feature branch after rebasing on master. But again, you should seriously think about why you are rebasing at all. – Tim Biegeleisen May 27 '18 at 03:57
  • Possible duplicate of [How to prevent lot of git conflicts when git rebasing lot of commits?](https://stackoverflow.com/questions/7241678/how-to-prevent-lot-of-git-conflicts-when-git-rebasing-lot-of-commits) – Andrew Marshall May 27 '18 at 03:58
  • But yea, as @TimBiegeleisen says, it doesn’t really make sense to rebase off master, then merge your own branch’s remote. Probably you just want to force push your branch if your workflow is to rebase off master. – Andrew Marshall May 27 '18 at 04:01
  • git push -f origin did the trick for me. Forcing that push didn't cause any rebase isssue further. – user1298426 May 27 '18 at 09:52

0 Answers0