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

How to revert to a specific commit?

From
TLtao lv <thebookofunknowable@gmail.com>
Date
Dec 2, 2024, 11:40 UTC
Message-ID
<CAFePT4zytyuLB0TgyJ+mbrNvz=Xt1x+gJv4e-2j07YK7Cg1bzw@mail.gmail.com>

I want to revert the code to a specific commit. This commit is not a direct part of the branch history; there are merge operations, branch forks, and other changes in between. Therefore, directly using `revert HEAD...commit` fails due to merge need -m.

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.

How can I achieve this? Is there a better way than using the revert function?
Next: Chris Torek
Message 1 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.