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

Re: How to revert to a specific commit?

From
Matěj Cepl <mcepl@cepl.eu>
Date
Dec 2, 2024, 12:50 UTC
Message-ID
<D6187MXMNNS6.11QZW2TCWKKNW@cepl.eu>
In-Reply-To
<CAFePT4zytyuLB0TgyJ+mbrNvz=Xt1x+gJv4e-2j07YK7Cg1bzw@mail.gmail.com>
On Mon Dec 2, 2024 at 12:40 PM CET, tao lv wrote:
> I don't want to revert each individual commit; I just want to restore
> the code to this specific commit while retaining all the current
> history commits.

Either git checkout <commit-id> for an inspection or git reset --hard <commit-id> for change of the current branch to that commit.

Matěj
-- 
http://matej.ceplovi.cz/blog/, @mcepl@floss.social
GPG Finger: 3C76 A027 CA45 AD70 98B5  BC1D 7920 5802 880B C9D8
 
Books aren’t written - they’re rewritten. Including your own. It
is one of the hardest things to accept, especially after the
seventh rewrite hasn’t quite done it.
  -- Michael Crichton, alluding to Steele MacKaye (1889) article
     where he said this about theater plays.
Previous: Chris Torek
Message 5 of 5 in “How to revert to a specific commit?”
  1. tao lvDec 2, 2024
  2. Chris TorekDec 2, 2024
  3. Junio C HamanoDec 3, 2024
  4. Chris TorekDec 3, 2024
  5. Matěj CeplDec 2, 2024

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.