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

Fwd: Set the repository as it was on an earlier commit

From
Sergio Belkin <sebelk@gmail.com>
Date
Dec 28, 2009, 05:18 UTC
Message-ID
<8c6f7f450912272118x384cd840j238b39efa9a87a3b@mail.gmail.com>
In-Reply-To
<8c6f7f450912272019t4b9c721dt2630a8d32607013e@mail.gmail.com>
Ooops I wanted to say Santi answer was the best
---------- Forwarded message ----------
From: Sergio Belkin <sebelk@gmail.com>
Date: 2009/12/28
Subject: Re: Set the repository as it was on an earlier commit
To: git@vger.kernel.org
2009/12/26 Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>:
Show 26 quoted lines
> Santi Béjar <santi@agolina.net> writes:
>
>> I don't know if it is possible with porcelain commands, but with
>> plumbing you can:
>>
>> # begin with a clean working dir
>> git read-tree B
>> git commit
>> git reset --hard
>
> I guess
>
> (at the root of the repo)
>
> git checkout B -- .
> # git status if you want to check.
> git commit
>
> does this. The "-- ." part of "git checkout" asks Git to checkout the
> files, but the path limiter prevents it from updating HEAD, so the
> HEAD still points to the tip of the branch.
>
> --
> Matthieu Moy
> http://www-verimag.imag.fr/~moy/
>

Sorry but really answer given by Steven was better, because last one omit the case when B had less files that D for example...

Thanks everyone

-- -- Open Kairos http://www.sergiobelkin.com Watch More TV http://sebelk.blogspot.com Sergio Belkin -

-- 
--
Open Kairos http://www.sergiobelkin.com
Watch More TV http://sebelk.blogspot.com
Sergio Belkin -
Previous: Sergio Belkin
Message 6 of 6 in “Set the repository as it was on an earlier commit”
  1. Sergio BelkinDec 25, 2009
  2. Steven NoonanDec 25, 2009
  3. Santi BéjarDec 25, 2009
  4. Matthieu MoyDec 26, 2009
  5. Sergio BelkinDec 28, 2009
  6. Fwd: Set the repository as it was on an earlier commitSergio Belkin, Dec 28, 2009

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.