git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Removing data from repository

From
Paul Smith <paul@mad-scientist.net>
Date
Jan 24, 2019, 15:22 UTC
Message-ID
<9dce6a3d8ff2f10621ea81fbd9ac9964c10aff9c.camel@mad-scientist.net>
In-Reply-To
<7A854577E980BE4FB29FDD041B9B75E701798CEE@NP1EXMB203.corp.halliburton.com>
On Thu, 2019-01-24 at 14:51 +0000, Naum Derzhi wrote:
Show 12 quoted lines
> Greetings,
> 
> I have this problem: years ago one of our developers committed a
> large (Gigabytes) piece of binary data into our project repository.
> This should not have been done, but it happened. (Honest, it was not
> me). We never needed this data in the repository.
> 
> Using git rm removes these files from the working tree, but they are
> still somewhere in the repository, so when we clone, we transfer
> gigabytes of unneeded data. 
> 
> Is it possible to fix this problem?

It is possible, but it isn't pretty. By waiting so long to try to fix it you've compounded the impacts dramatically unfortunately. By removing that file you will in effect be rewriting the history of your repository starting with the commit that introduced the problematic file, that will be removed, all the way forward.

That means that every clone of the repository will have to be, at the very least, "hard-reset" and preferably (to avoid accidentally re- introducing the bad file) re-cloned from scratch.

As for actually removing the file, you can find information on how to do this all over the Google. Here's some reasonable advice from StackOverflow:

https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository
Previous: Naum DerzhiNext: Naum Derzhi
Message 4 of 5 in “Removing data from repository”
  1. Naum DerzhiJan 24, 2019
  2. Jeff KingJan 24, 2019
  3. Naum DerzhiJan 24, 2019
  4. Paul SmithJan 24, 2019
  5. Naum DerzhiJan 24, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.