{"thread":{"id":"1351","subject":"[PATCH] add \"-f\" option to git-commit-script to force commit withoutchanges","startedAt":"2005-07-28T14:47:49Z","lastAt":"2005-07-29T11:06:06Z","messageCount":3,"participants":["Johannes Schindelin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6502","messageId":"Pine.LNX.4.58.0507281646340.25783@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1351","inReplyTo":null,"subject":"[PATCH] add \"-f\" option to git-commit-script to force commit withoutchanges","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-07-28T14:47:49Z","receivedAt":"2005-07-28T14:47:49Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nSometimes a failed automatic merge means that we do not want those\nchanges. In this case, it is desirable to commit the current HEAD (as if\nactually something was merged).\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n git-commit-script |    8 ++++++--\n 1 files changed, 6 insertions(+), 2 deletions(-)\n\n89e6c9495d7877e9922b22d6c87f51c6902b7056\ndiff --git a/git-commit-script b/git-commit-script\n--- a/git-commit-script\n+++ b/git-commit-script\n@@ -6,12 +6,16 @@\n . git-sh-setup-script || die \"Not a git archive\"\n\n usage () {\n-\tdie 'git commit [-m existing-commit] [<path>...]'\n+\tdie 'git commit [-f] [-m existing-commit] [<path>...]'\n }\n\n+force=false\n while case \"$#\" in 0) break ;; esac\n do\n     case \"$1\" in\n+    -f) shift\n+        force=true\n+        ;;\n     -m) shift\n         case \"$#\" in\n \t0) usage ;;\n@@ -82,7 +86,7 @@ else\n \tfi >.editmsg\n \tgit-status-script >>.editmsg\n fi\n-if [ \"$?\" != \"0\" ]\n+if [ \"$?\" != \"0\" -a $force = false ]\n then\n \tcat .editmsg\n \trm .editmsg\n"},{"id":"6543","messageId":"7vslxypcw6.fsf@assigned-by-dhcp.cox.net","threadId":"1351","inReplyTo":"Pine.LNX.4.58.0507281646340.25783@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] add \"-f\" option to git-commit-script to force commit withoutchanges","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-29T02:24:57Z","receivedAt":"2005-07-29T02:24:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"While I agree there should be a graceful way to go back to the\noriginal head from a failed merge situation, I do not think\n\"committing the current HEAD\" is the right model for the end\nuser to think about it.\n\nWouldn't using \"checkout -f\" to revert to the version you would\nwant to go back work as expected?\n"},{"id":"6579","messageId":"Pine.LNX.4.58.0507291300340.5849@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1351","inReplyTo":"7vslxypcw6.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] add \"-f\" option to git-commit-script to force commit withoutchanges","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-07-29T11:06:06Z","receivedAt":"2005-07-29T11:06:06Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 28 Jul 2005, Junio C Hamano wrote:\n\n> While I agree there should be a graceful way to go back to the\n> original head from a failed merge situation, I do not think\n> \"committing the current HEAD\" is the right model for the end\n> user to think about it.\n>\n> Wouldn't using \"checkout -f\" to revert to the version you would\n> want to go back work as expected?\n\nI had the following situation: in a throw away tree I made some changes.\nThe last conflicted with a change I pulled from somewhere else into the\nmaster, and the best solution was to revert that last change from the\nthrow away tree. Basically, the result of the merge was identical to\nmaster, i.e. git-status says \"nothing to commit\". I wanted to document,\nhowever, that I do not want that change from the throw away tree in my\nmaster, even if I keep it in the throw away tree.\n\nI am no longer sure if that was a good thing to do, maybe I should have\nfixed it in the throw away tree by merging master there. Or, alternatively\ngit-commit could check for \"nothing to commit\" OR \"MERGE_HEAD exists\".\nDunno.\n\nCiao,\nDscho\n"}]}