5

I have the following scenario:

  1. I create a local branch from master
  2. Work on the local branch, commit changes
  3. Switch to master using the Visual Studio git plugin
  4. Do some changes on master, commit, sync
  5. When I switch back to the local branch I immediately have uncommitted changes on that branch for the files that I edited on master. So if I view changes on those files there are no actual changes but I am guessing that the date modified of the files changed or something.

At first this was a just nuisance, but when you switch back to master, master will have 'ghost' changes for the files edited in the local branch, so if you continue working like this for a while you are spammed with conflicts when merging the two branches and this can lead to loss of work.

Any clues?

Micha Wiedenmann
  • 19,979
  • 21
  • 92
  • 137
John
  • 634
  • 8
  • 17

2 Answers2

2

Problem may be with CRLF (how to change line ending settings)

  1. Checkout Windows-style, commit Unix-style line endings Git will convert LF to CRLF when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects, this is the recommended setting on Windows ("core.autocrlf" is set to "true")
  2. Checkout as-is, commit Unix-style line endings Git will not perform any conversion when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects this is the recommended setting on Unix ("core.autocrlf" is set to "input").
  3. Checkout as-is, commit as-is Git will not perform any conversions when checking out or committing text files. Choosing this option is not recommended for cross-platform projects ("core.autocrlf" is set to "false")
Community
  • 1
  • 1
Adrian
  • 406
  • 4
  • 9
0

Is your ignore file correct on both branches? It could be that you have accidentally added a file Visual Studio uses that should not be in your repository.

You can try a curated .gitignore file such as this one. But if you've already added the files to your repository git will keep tracking their changes even if they are in the ignore file

Roy T.
  • 9,429
  • 2
  • 48
  • 70
  • Ignore files is not modfieid at all, is the same in all branches. If that was the case I would get changes on some specific file(s) that I could ignore from git ignore. But changes are on files that where edited/created on the branch before switching. – John Oct 25 '16 at 10:49