Reputation: 3857
Not sure exactly how to title this question, because I'm not 100% certain what the problem is. I assume that while downloading the latest changes to our repository a file has been corrupted.
One of our source files came out looking like this:
⼀⼀⼀ 㰀⼀猀甀洀洀愀爀礀㸀ഀഀ
嬀䌀甀猀琀漀洀䔀搀椀琀漀爀⠀琀礀瀀攀漀昀⠀唀䤀圀椀搀最攀琀⤀⤀崀ഀഀ
public class UIWidgetInspector : Editor
笀ഀഀ
enum Action
ऀ笀ഀഀ
None,
ऀऀ䴀漀瘀攀Ⰰഀഀ
Scale,
ऀऀ刀漀琀愀琀攀Ⰰഀഀ
}
ഀഀ
I have no idea why this has happened, but when I look at the file on GitHub is appears fine, and the other programmer is not having this problem. I am assuming that there was some corruption when I fetched the remote branches.
My first instinct was to delete and redownload all of my remote branches, but I have no idea how to do this.
I have tried:
git branch -rd origin/master
And then fetching again, but no data is actually downloaded (presumably because the commits still exist locally).
Basically I have no idea what's going on, and short of cloning the repo again (which I'd rather not do), I am completely lost.
Upvotes: 1
Views: 490
Reputation:
Is the file encoded in something other than ASCII or UTF-8? If not, then Git might think it's binary and corrupt it if you have line-ending normalization turned on.
It's well known that Git doesn't like things like UTF-16 encoding. See, for example, How to stop git from breaking encoding on checkout.
Upvotes: 0
Reputation: 21543
The most straightforward thing to do is make a new clone in a new location:
git clone <repo url> new-directory-name
and then verify that the problem is gone in the new clone. If all is okay, and you don't need anything from the existing repository, just throw it away and use the new copy. If you do need something you've been working on from the old repository, you'll have to do some copying between those two.
The key point is that there's nothing special about a repository. You can have as many copies of it as you want.
It's possible, of course, that there is an encoding issue; but this is the first thing I would check.
Upvotes: 1