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

Re: Removing some files from history

From
Jakub Narebski <jnareb@gmail.com>
Date
Oct 17, 2008, 12:20 UTC
Message-ID
<m34p3bjtx4.fsf@localhost.localdomain>
In-Reply-To
<96ed5eac0810170451y69fd864jb44ef62bca468498@mail.gmail.com>
Please do not toppost, and quote only fragments you are replying to.
"Gennady Kushnir" <genkush@rujel.net> writes:
> thank you for precise instructions.
> 
> however I did not completely understand the part about references
> and reflog what are these? git tags?

git-filter-branch saves old version under refs/original/* namespace. You have to remove them after making sure that your rewritten history is correct.

Additionally git keeps log where branch (tip/head of branch) was in your repository; this is kind of generalization of ORIG_HEAD, and allows to recover from such mistakes as wrong "git reset --hard". Reflog entries from your original history also would pin commits, so you have to expire reflog.

And finally the commits you have are there in repository, so you have to "prune" repository to get rid of them. Reflog entries and refs/original/* pin those commits, so you have to remove them prior to pruning. Pruning simply removes objects which are unreferenced.

> and another question:
> did I understand it right, that I can even make some changes to that
> file in history - not just simply delete one?
Yes, see man git-filter-branch.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Gennady Kushnir
Message 5 of 5 in “Removing some files from history”
  1. Gennady KushnirOct 17, 2008
  2. Jeff KingOct 17, 2008
  3. Michael J GruberOct 17, 2008
  4. Gennady KushnirOct 17, 2008
  5. Jakub NarebskiOct 17, 2008

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.