Getting Git to follow renamed and edited files

前端 未结 3 642
耶瑟儿~
耶瑟儿~ 2020-12-03 21:12

Questions about renaming files in Git have been asked before, but I can\'t work out a solution to my specific problem.

I have moved and edited multiple files (I didn

3条回答
  •  旧巷少年郎
    2020-12-03 22:08

    git diff was not picking up that I'd renamed files and altered their contents. My scenario was I had files A, B, C, and inserted a new B, so old B was now C, and old C was now D. git diff was telling me B and C were now completely different!

    The solution I used was tedious and manual, but did get the job done.

    1. Renamed the files back, as best I could. I.e. B to Bnew, C to B, D to C.
    2. Did the diff, to check no mistakes.
    3. Committed that.
    4. Used git mv to name the files back to their new names. B to C, C to D.
    5. Committed that.
    6. Did the other renames, and committed them as new files. I.e. Bnew to B.

提交回复
热议问题