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

git-kill: rewrite history removing a commit

From
MTMichael S. Tsirkin <mst@mellanox.co.il>
Date
Jan 31, 2007, 19:55 UTC
Message-ID
<20070131195533.GE21097@mellanox.co.il>

Below is a simple script that rewrites history reverting a single commit. This differs from git-revert in that a commit is completely removed, and is especially useful before one has published a series of commits.

Do you find this useful? Comments? Drop me a line.

#!/bin/sh
commit=$1;
#git-rev-list $commit.. 
revlist=`git-rev-list $commit.. | tac`
git reset --hard $commit
git reset --hard HEAD~1
for rev in $revlist
do
	git-cherry-pick $rev
done
-- 
MST
Next: Yann Dirson
Message 1 of 5 in “git-kill: rewrite history removing a commit”
  1. Michael S. TsirkinJan 31, 2007
  2. Yann DirsonJan 31, 2007
  3. Catalin MarinasFeb 1, 2007
  4. Junio C HamanoJan 31, 2007
  5. Michael S. TsirkinJan 31, 2007

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.