0

I have two separate clones of the same remote git repository. In one of them, I created a file testme that contains a single line of text "test1". I added, committed, and pushed the file to origin.

In the other clone, I again created a file testme, this time containing a single line of text "test2". I did not add, commit or do anything else with it. I then tried "git pull origin" on the second clone.

I got the error about untracked files being overwritten, which was expected, as I wanted to see exactly how git handles this particular scenario.

I then ran

git diff origin/beta --name-status

which got me this output

D       testme

The diff-filter section of the git diff man page says that 'D' is for deleted. What I don't understand is why 'deleted' is the proper category for this file, rather than anything else. Can anyone explain?

Some Guy
  • 1,481
  • 12
  • 26

1 Answers1

0

When you pull in this scenario, Git thinks that there was a file called testme in the "clone 2" too, but you delete it.

Dherik
  • 17,757
  • 11
  • 115
  • 164
  • That makes some sense, but I just tried pushing another file via the first clone, and the git diff only complains about the file that I have an untracked local copy of. – Some Guy May 16 '13 at 03:03
  • Never mind, it does list all files that I don't have locally. But what makes a bit more sense to me is that git is describing what I would need to do to origin to make it look like my local copy. – Some Guy May 16 '13 at 15:42