0

For the time being I need to be working with a user un-friendly graphical IDE.

I want to facilitate the renaming/moving of some modules, but on the backend the IDE creates modules with several binary files. My last compile failed after using git mv to rename a misspelled module.

My guess is that in the binary files there were path references that I can't see.

It's simple enough for me in this IDE to facilitate this procedure by making a new module, copy pasting the contents, and deleting the old one (all in the IDE).

That move sadly breaks the git history, and I would like to maintain that. Is there a way to do this pseudo type of file moving/renaming, and then after the fact tell git that they were the same and re-tie them together?

CharlieBrown
  • 363
  • 2
  • 5

1 Answers1

1

Git doesn't really know about file renaming. You can do what you described (cut the entire contents of an old file and paste into a new file), and when you git rm the old and git add the new, git status will say that you renamed that file.

However, I suppose what you are aiming at is to be able to ask Git for the history of the new filename and also have it show you the history of the old file before it was renamed. This is not exactly supported by Git in the way that you are probably hoping for, but there is a "hack" in git log --follow which tries to do it. That, as well as the mechanics of what happens when you move file contents, is detailed here: How to REALLY show logs of renamed files with git?

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • Yes, the `git log --follow` is what I am trying to do (I think my syntax: `git log -- [path]` is the same). From the link you had provided I am understanding that there is no way to... "re-stitch" these files together for the log's follow option, and that the method of tracking - even with renames - is just through proper commit analysis. There is no way to tie a `rm` and an `add` together for the sake of `git log --follow`. Do you concur? – CharlieBrown Jul 18 '18 at 15:11
  • Try using `git log --follow -- [path]`. It tries to stitch together the removes and adds...or at least it's supposed to, I haven't tried it. – John Zwinck Jul 19 '18 at 05:58