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

[PATCH] git-fixup: automatically create a fixup commit

From
MTMichael S. Tsirkin <mst@redhat.com>
Date
May 1, 2016, 09:53 UTC
Message-ID
<1462096410-8813-1-git-send-email-mst@redhat.com>
Sometimes I get a broken patch, apply it and then need to fix it up. git
commit --fixup is perfect for this, but makes me look up the commit that
created the breakage manually. git-fixup is a tool to speed this up.
Several heuristics would be reasonable for locating the problematic
commit:
1. look up the last commit that touched the
   file(s) affected by the fixup
2. look up the last commit that touched the
   line(s) affected by the fixup
this implements the first heuristic.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 contrib/git-fixup | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100755 contrib/git-fixup
diff --git a/contrib/git-fixup b/contrib/git-fixup
new file mode 100755
index 0000000..79f4e34
--- /dev/null
+++ b/contrib/git-fixup
@@ -0,0 +1,8 @@
+if
+	git diff --cached --quiet 
+then
+	echo "Nothing to commit!"
+	exit 1
+else
+	git commit --fixup=$(git log --pretty=format:%H -1 $(git diff --cached --name-only)) "$@"
+fi
-- 
MST
Message 1 of 1 in “git-fixup: automatically create a fixup commit”
  1. git-fixup: automatically create a fixup commitMichael S. Tsirkin, May 1, 2016

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.