George Karpenkov <geo...@metaworld.ru> writes:

> Hi All,
>
> I've managed to corrupt my very valuable repository with a recursive
> sed which went wrong.
> I wanted to convert all tabs to spaces with the following command:
>
> find ./ -name '*.*' -exec sed -i 's/\t/    /g' {} \;

Clearly, this is a dangerous command as it impacts .git/. However, Git
partially protects you from this kind of error, since object files and
pack files are read-only by default.

My obvious first advice is: make backups of your corrupted repository.
Yes, I said backup_s_, better safe than sorry.

Then, the errors you get are in *.idx files, which are basically index
for pack files, for quicker access. You can try removing these files,
and then running "git index-pack" on each pack file, like

$ rm .git/objects/pack/pack-*.idx
$ git index-pack 
.git/objects/pack/pack-4745076928ca4df932a3727b8cc25e83574560bb.pack            
            
4745076928ca4df932a3727b8cc25e83574560bb                                        
                      
$ git index-pack 
.git/objects/pack/pack-c74a6514f653d0269cdcdf9c1c102d326706bbda.pack
c74a6514f653d0269cdcdf9c1c102d326706bbda

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to