Git stubborn file

Answered

Has anyone come across a problem where:

  1. you have a file that you created long ago, it has a rich commit history
  2. you have a master branch
  3. you have a feature branch you are working on branched from master
  4. git compare with branch (master) shows the file as completely everything new, a new file - the whole thing is higlighted
  5. git compare with... is greyed out
  6. all other files in the project allow you to compare with previous versions, except this one... but you can go into the git file history and do diffs there
  7. last time i tried to merge, merge would not allow until conflicts were resolved... conflicts only in this file... accept theirs, accept yours, deleting all changes using the x buttons in the diff, nothing would allow the conflict to be resolved.. so merge could not be completed. also in the conflict resolve diff merge window, the result is full of the file code, the left and right panes are completely empty

How do I solve this? preferably without losing my history for the file.

0
3 comments

Just to confirm, Git - Show history for the file shows all the history with no issue?

And does command line diff work for the file?

git diff branch master -- path/to/problematic/file
0
Avatar
Permanently deleted user

not entirely sure how to run that command correctly, i tried from the command prompt but it was saying something about no repository.. anyhow... I managed to fix that file somehow... I had been modifying it. And I committed it a couple of times. Now I get the full history with compare with... before there would be no history that way, only if you opened the history: tab

unfortunately I found another 2 files (from the the same package) with the same problem. So we will have to wait and see if it ever gets fixed by itself. For example I tried compare with branch and the message pops up "couldn't compare with branch" (message '... doesn't exist in branch'), compare with... dialog "nothing to show"... show history... tab opens and it is all there

 

0
Avatar
Permanently deleted user

I noticed that if I do git ls-tree -r master --name-only
then the problem files will not show up.. but I cannot add them to git since it is already added (The git/add is greyed out in intellij)

so how can I "add" it back... I did manage to "rescue" another file, but i'm still not sure how I'm doing it.. somehow it does magically get back it's version history... But I mean after I did some things with the file, which I can't remember/replicate.

0

Please sign in to leave a comment.