2

I'm on my own branch, and on a commit 5 or 6 commits ago I get this issue

First, rewinding head to replay your work on top of it...
Applying: commit x
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
error: The following untracked working tree files would be overwritten by merge:
        .idea/.gitignore
        .idea/credit-policy-runs.iml
        .idea/dataSources.xml
        .idea/misc.xml
        .idea/modules.xml
        .idea/vcs.xml
Please move or remove them before you merge.
Aborting
error: Failed to merge in the changes.
Patch failed at 0001 commit x
hint: Use 'git am --show-current-patch' to see the failed patch

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".


When I can't do git rm and git rebase --continue I had a similar issue a while back but thought I resolved it, apparently I just pushed it off.

Update: When I remove vim .idea/.gitignore there is a file, but when I run git rm .idea/.gitignore I get fatal: pathspec '.idea/.gitignore' did not match files

Update: When I try to run the rebase with -Xtheirs I get these errors

CONFLICT (modify/delete): Runs.avpr deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of Runs.avpr left in tree.
CONFLICT (modify/delete): .idea/misc.xml deleted in origin/develop and modified in HEAD~63. Version HEAD~63 of .idea/misc.xml left in tree at .idea/misc.xml~HEAD~63.

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".
sf8193
  • 575
  • 1
  • 6
  • 25

4 Answers4

1

for those coming across this, I was not able to find a solution, and instead copied the entire directory into a temp directory, created a new branch, and moved it from temp directory to new branch. Pretty brutal, and lost all commit history but it's the only thing I could figure out.

sf8193
  • 575
  • 1
  • 6
  • 25
0

From what I can read there, the files are not tracked on your branch (good... IDE metadata files should not be tracked).... but on the other branch the files are tracked....which is probably not correct. Go see why/when the files were added in that branch and remove them from the branch (there are tons of recipes to delete files from history of a branch), then this won't happen when you try to merge.

How can I delete a file from a Git repository?

eftshift0
  • 26,375
  • 3
  • 36
  • 60
  • It was a rebase. Very likely the commits which have the files are the op's own commits. – max630 Dec 24 '19 at 23:33
  • Oh! So it's happening before `git rebase` does the checkout of the other branch.... either way the problem is in the history of the other branch. – eftshift0 Dec 25 '19 at 00:15
  • @eftshift0 the commits are mine, you can consider the other branch master(because it is) and it is empty – sf8193 Dec 25 '19 at 19:33
  • This leaves me in a position where i'm unsure of how to delete them because they are simply an older commit that for some reason added those files and continued to ignore them afterwards. – sf8193 Dec 25 '19 at 19:35
0

follow the steps to solve the issue

  1. take the backup file from your project
  2. git checkout master
  3. git branch -d "your branch name"
  4. git pull origin master
  5. git branch "your branch name" and then git checkout "your branch name"
  6. copy your modified file from backup and paste to your project folder
  7. use to remove git rm --cached -r .idea (for windows: "DEL /S /Q .idea" use instead of "git rm --cached -r .idea") if the git rm not worked

    finally push your code

-1
git stash
git pull origin master --rebase

if a conflict arises, fix the conflict and

git add .
git rebase --continue

Repeat until you get message rewinding...

git stash pop
Binod Paneru
  • 113
  • 1
  • 13