Git output invalid Windows file names

I am working with a common project using git for version control. I am in the windows while my partner is on Unix.

My partner named some files with <file1>.txt . When I try to pull out these files, they are not accepted, since < and > are invalid characters for Windows. This is normal, I do not need to touch the files. However, they are added to my commit as deleted. So, if I click, then I will delete these files, which I do not want to do.

  • I cannot use git reset --hard because it detects an invalid path for each of these "deleted" files.

  • Is there any way to exclude these files from my commits? I tried adding <file1> to my .git/info/exclude , but that didn't work.

+8
git windows filenames
source share
2 answers

Ignoring does not help if the files are already being tracked.

Use Allow Validation to skip these files.

0
source share

You need your partner to change the names so that they are also valid on Windows. After they renamed them, I would do the following:

  1. Make a backup copy of any changes that you made only locally (both uncommitted and committed, but not sent).
  2. Run git reset --hard <commit> where <commit> is any commit that was before the files were added.
  3. Run git pull to go to the latest version (where the files are renamed).
  4. Restore your backup changes from 1.

Then you should get a newer version, where the files are not named in this, on Windows, in an illegal way and they will not be deleted (or ever created) from under the OS bastard :)

PS I know this is an old question, but I recently got this problem, so hopefully the solution I came to can help others as well.

+2
source share

All Articles