简体   繁体   中英

Recover blobs which are falsely line-ending converted with git

I have a history in git, where in a commit A we have a .gitattributes files with

* text eol=lf

which is clearly wrong because it will convert all paths to LF even binaries before checkin. So that happend and I am wondering if a binary file/blob F in the history is corrupt (because of crlf got converted to lf) can be restored such that the conversion is undone.

If that procedure is applicable I would apply it in a git filter-branch somehow...

PS: I made a new history with a corrected .gitattribute file everywhere on master

* text=auto eol=lf

made a new orphan branch new-master and rebased the whole master onto it. But that does not solve the problem, the file/blobs are left of course corrupt...

If the data stored in the Git repository are not the data you meant to store, no Git command is going to be able to find the data that you did mean to store.

In other words: no, there is no way to get the correct data from the wrong data. If you have the correct data somewhere, that's where you get the correct data.

All that git filter-branch (or the new and improved git filter-repo ) can do is copy each original commit with some set of filters applied as it goes. The existing original commit, with its original snapshot, remains in the repository for a while; the new commit, with its new snapshot, is the one that you'll find when using the updated branch name(s) to find commits.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM