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

Re: Repo cleanup problem

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
May 11, 2007, 08:10 UTC
Message-ID
<vpqveezhjb0.fsf@bauges.imag.fr>
In-Reply-To
<9909dee80705110103h5b848490m296c001beecfa1f1@mail.gmail.com>
"Eugine Kosenko" <eugine.kosenko@gmail.com> writes:
> For now I'm looking for a way to remove the garbage commit.

Branch before the garbage commit. Then, you can use git-rebase to replay the correct history on top of your new branch. Note that git-rebase will break merging if you already used merge: it does not "move" your old commits to your new branch, it instead creates new commits with the same changes at the old ones, in the new branch.

That's probably what you've done already.

Then, to have git-gc remove the old, bad, history, you need to remove any reference you have to it: branches and tags. git-branch -d and perhaps git-tag -d will tell you.

See also git-fsck that can point you to dangling objects, which should then be removed by git-gc.

gitk --all, on the other hand, will show you the commits to which you have a reference (and their ancestry).

-- 
Matthieu
Previous: Eugine KosenkoNext: Karl Hasselström
Message 2 of 4 in “Repo cleanup problem”
  1. Eugine KosenkoMay 11, 2007
  2. Matthieu MoyMay 11, 2007
  3. Karl HasselströmMay 11, 2007
  4. Eugine KosenkoMay 11, 2007

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.