I face a merge conflict when I would like to rebase the develop
branch against my feature
branch. I use IntelliJ Idea to execute individual Git commands. Let's say I have 3 pushed commits and I want to squash and rebase them using --interactive
mode.
I select all three commits, I select squash
, do some rewording, and hit Rebase
.
The process fails and an Excel file that appears in the Git panel among Changes and on the diff panel, says the contents are the same. I can only abort or retry the rebase, but continuing doesn't make sense as the change always prevents me to continue.
Here is the console output:
12:50:42.385: [myapplication] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false -c core.commentChar= rebase --interactive develop
Rebasing (1/2)
error: Your local changes to the following files would be overwritten by merge:
excel-file.xlsx
Please commit your changes or stash them before you merge.
Aborting
hint: Could not execute the todo command
hint:
hint: fixup 37d1fc57dff9c7e9a312c88cf78c176cb71dbb47 CommitMessageIsHere
hint:
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint:
hint: git rebase --edit-todo
hint: git rebase --continue
Could not apply 37d1fc5... CommitMessageIsHere
Is there a trick to overcome this obstacle? Is possible to somehow force ignoring and skipping such merge conflict?
CodePudding user response:
You started your rebase with un untracked copy of excel-file.xlsx
, and when git
met a commit which included the action "create a new excel-file.xlsx
file", he stopped.
You have to somehow put aside this untracked version before proceeding.
The simplest way is:
rename that file on disk:
mv excel-file.xlsx excel-file.xlsx.tmp
run
git rebase --continue
:
either IntelliJ has a button which looks like "proceed with the rebase", or you can run this command from the command line,once the rebase is complete:
you can compare the contents of both files, and decide what the correct action is -- update the tracked version, delete the tmp file ...