0

I am trying to import a repository (https://github.com/LibreOffice/core.git) into Azure Devops but can't due to the fact it has corrupted commits (too many < or wrong spaces etc far back in its history). This also prevents it being imported into Github.

A solution I have tried is to do a shallow clone (not include the old corrupted commits) to a local repo and then push that to Azure Devops but I get the error "shallow update not allowed" as explained in this previous thread Remote rejected (shallow update not allowed) after changing Git remote URL

All the solutions result in having to unshallow the repo first. I can't do that as doing that will include the corrupted commits. Is there no way of cloning and removing the corrupted commits?

itadvicehelpsdf
  • 147
  • 1
  • 3
  • 10
  • 2
    you can just download the state you want and delete the `.git` folder and upload the files as there is no git history (you will lose all the git history, obv, but the upload will work) – 4c74356b41 Mar 23 '20 at 17:35
  • Thanks - I assume I can't then push updates from the open source repo to my changes with this method? Or would there be a way to update new commits – itadvicehelpsdf Mar 24 '20 at 09:58
  • And I assume I just clone then delete the init folder then run git init again? – itadvicehelpsdf Mar 24 '20 at 10:06
  • i think you should be able to, git history doesnt have to be exactly the same to push updates to the origin – 4c74356b41 Mar 24 '20 at 12:21
  • Thanks but how can I do that? I've deleted the git folder so it has not history or reference to the old repo. If I add it as origin and pull won't it pull all the history? How will it know what the new changes are without any history? – itadvicehelpsdf Mar 25 '20 at 13:46

1 Answers1

0

You could try git-cherry-pick to cherry-pick a range of commits and skip the corrupted commits:

$ git cherry-pick A^..B 
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39