4

My coworker use eclipse to rename many files for example: apple.java to Apple.java

so when I pull the code,it has conflict
the git hint said I have to delete those file before pull,but I don't want to
How can I solve this conflict??

user2492364
  • 6,543
  • 22
  • 77
  • 147
  • I cannot replicate this; my tests (1) use the unix `mv` command to rename a file, (2) `git add -u .`, (3) `git commit` (4) on another working copy, git pull either fast-forward or creates a merge, without conflict. Maybe your files diverged too much, and if so, `git mv` as suggested by other answers won't help; see also http://stackoverflow.com/questions/2701790/git-merge-with-renamed-files. – coredump Jul 30 '15 at 14:21
  • Please, post the exact output of `git status`. – Matthieu Moy Jul 30 '15 at 17:11

2 Answers2

2

When you changed file name by eclipse git wasn't informed about that. It means it still expects "apple.java" to be on your hard drive and it considers "Apple.java" as some non-staged file (not added one).

What you should do is to move files back on your hard drive (in any way) and then "git mv" them again.

Pull shouldn't be a problem after you do that and commit your changes.

Maciej Oziębły
  • 1,769
  • 15
  • 14
1

It's not the good way to rename file like your coworker. Try git mv apple.java Apple.java then git commit -m "Rename file" and then : git pull. It should fix your problem.

alifirat
  • 2,899
  • 1
  • 17
  • 33