0

I'd like to understand the following situation about my git repository.

I'm at commit XXX and I have a clean repos (nothing untracked/modified) aligned with the last commit on origin/develop.

My colleague has created and pushed with Visual Studio, a new commit YYY on top of the previous commit XXX containing among others a project.csproj file having 4 new lines.

Just after that I pulled from origin/develop and retrieved only the commit YYY.

Now, the project.csproj file and only this one appears modified and impossible to undo with git checkout project.csproj.

The difference with the modified project.csproj and the one on the commit YYY is that mine (the modified) has 4 less lines.

My question is, since i have pulled the commit with those 4 new lines why they weren't took into account?

git clean, git reset, git clone changed nothing.

If i git stash the file project.csproj is copied to a new stash instead of being moved.

My colleague went back again to his VisualStudio and the project.csproj was surprisingly still modified with 4 new lines. He added the file to a commit ZZZ and pushed it to origin/develop.

When i pulled the commit ZZZ everything went back to normal, and project.csproj isn't anymore in modified status.

The SHA generated on project.csproj (in commit ZZZ and commit YYY) with

git ls-files -s project.csproj

after checking out is the same.

This situation is reproducible when I return to the commit YYY

Could someone clarify the situation?

Thank you in advance

Mentezza
  • 627
  • 5
  • 16
  • VS bug most likely. – Mike Makarov Mar 03 '20 at 13:40
  • I don't use VS (so someone who does needs to provide a real answer) but it seems that `.csproj` files are controlled and maintained by VS itself and therefore should never be committed. See also VonC's answer [here](https://stackoverflow.com/q/21511959/1256452). – torek Mar 03 '20 at 16:52
  • @torek, you confuse *.csproj and *.csproj.user, the latter contains user preferences. The first one contains the project structure, the files, the references,.... and must be committed. – Mentezza Mar 05 '20 at 14:50
  • As I said, I don't actually *use* VS. I am merely relaying others' recommendations. If these files are XML, Git cannot merge them correctly. – torek Mar 05 '20 at 19:46

0 Answers0