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

[PATCH] add "-f" option to git-commit-script to force commit withoutchanges

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 28, 2005, 14:47 UTC
Message-ID
<Pine.LNX.4.58.0507281646340.25783@wgmdd8.biozentrum.uni-wuerzburg.de>

Sometimes a failed automatic merge means that we do not want those changes. In this case, it is desirable to commit the current HEAD (as if actually something was merged).

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
 git-commit-script |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
89e6c9495d7877e9922b22d6c87f51c6902b7056
diff --git a/git-commit-script b/git-commit-script
--- a/git-commit-script
+++ b/git-commit-script
@@ -6,12 +6,16 @@
 . git-sh-setup-script || die "Not a git archive"

 usage () {
-	die 'git commit [-m existing-commit] [<path>...]'
+	die 'git commit [-f] [-m existing-commit] [<path>...]'
 }

+force=false
 while case "$#" in 0) break ;; esac
 do
     case "$1" in
+    -f) shift
+        force=true
+        ;;
     -m) shift
         case "$#" in
 	0) usage ;;
@@ -82,7 +86,7 @@ else
 	fi >.editmsg
 	git-status-script >>.editmsg
 fi
-if [ "$?" != "0" ]
+if [ "$?" != "0" -a $force = false ]
 then
 	cat .editmsg
 	rm .editmsg
Next: Junio C Hamano
Message 1 of 3 in “add "-f" option to git-commit-script to force commit withoutchanges”
  1. add "-f" option to git-commit-script to force commit withoutchangesJohannes Schindelin, Jul 28, 2005
  2. Junio C HamanoJul 29, 2005
  3. Johannes SchindelinJul 29, 2005

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.