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

Re: removing very old commits (including initial)

From
SBSanti Béjar <santi@agolina.net>
Date
Jul 28, 2010, 09:10 UTC
Message-ID
<AANLkTim7yLFXZ8hgH1=agq2Qi7TUFk=348Pxb=SB67dm@mail.gmail.com>
In-Reply-To
<20100728115309.08ed6fdd@packard.rktmb.org>

On Wed, Jul 28, 2010 at 10:53 AM, Mihamina Rakotomandimby <mihamina@gulfsat.mg> wrote:

Show 14 quoted lines
> Manao ahoana, Hello, Bonjour,
>
> I work on a personnal project that become a little bit bigger over the
> time.
> Initially, it was a single file one, and that file contained database
> credentials.
> Later, I splat the project and put the credentials in another untracked
> file (.gitignore).
> When I want to publish this project, the history contains the initial
> file, with the credentials. I dont want to publish that.
>
> It's not a problem to definitely wipe the "single file" part of history
> of this project, but interesting to keep the history after the
> split&untracking.

If I understand you correctly you want to publish only the commits since a particular commit, say "newroot". You can do it with "git filter-branch". You have many different filters, but in you case I would you grafts to cut the history and the rewrite the history with git filter-branch.

In .git/info/grafts you put something like this: HashOfTheNewRoot

It means that this commit has no parent, so you are cutting the history. You can examine the history with git log or gitk to check everything looks fine. To make it definitive you have to execute git filter-branch:

$ git filter-branch -- --all
--all in this case means all the refs.

HTH, Santi

Show 16 quoted lines
>
> How to?
> Publishing will be through gitweb.
>
> Misaotra, Thanks, Merci.
>
> --
>
>       Architecte Informatique chez Blueline/Gulfsat:
>    Administration Systeme, Recherche & Developpement
>                                    +261 34 56 000 19
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Previous: Ævar Arnfjörð Bjarmason
Message 3 of 3 in “removing very old commits (including initial)”
  1. Mihamina RakotomandimbyJul 28, 2010
  2. Ævar Arnfjörð BjarmasonJul 28, 2010
  3. Santi BéjarJul 28, 2010

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.