{"thread":{"id":"42191","subject":"[PATCH] git-fixup: automatically create a fixup commit","startedAt":"2016-05-01T09:53:34Z","lastAt":"2016-05-01T09:53:34Z","messageCount":1,"participants":["Michael S. Tsirkin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"285068","messageId":"1462096410-8813-1-git-send-email-mst@redhat.com","threadId":"42191","inReplyTo":null,"subject":"[PATCH] git-fixup: automatically create a fixup commit","fromName":"Michael S. Tsirkin","fromEmail":"mst@redhat.com","sentAt":"2016-05-01T09:53:34Z","receivedAt":"2016-05-01T09:53:34Z","isPatch":true,"sender":{"key":"mst@kernel.org","avatar":null},"body":"Sometimes I get a broken patch, apply it and then need to fix it up. git\ncommit --fixup is perfect for this, but makes me look up the commit that\ncreated the breakage manually. git-fixup is a tool to speed this up.\nSeveral heuristics would be reasonable for locating the problematic\ncommit:\n1. look up the last commit that touched the\n   file(s) affected by the fixup\n2. look up the last commit that touched the\n   line(s) affected by the fixup\n\nthis implements the first heuristic.\n\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\n---\n contrib/git-fixup | 8 ++++++++\n 1 file changed, 8 insertions(+)\n create mode 100755 contrib/git-fixup\n\ndiff --git a/contrib/git-fixup b/contrib/git-fixup\nnew file mode 100755\nindex 0000000..79f4e34\n--- /dev/null\n+++ b/contrib/git-fixup\n@@ -0,0 +1,8 @@\n+if\n+\tgit diff --cached --quiet \n+then\n+\techo \"Nothing to commit!\"\n+\texit 1\n+else\n+\tgit commit --fixup=$(git log --pretty=format:%H -1 $(git diff --cached --name-only)) \"$@\"\n+fi\n-- \nMST\n"}]}