ref: 3f2cb884bedaf1a335bae00b42605e63b956e197
parent: 544dbac25e2d7ba3165b8e5370dd9b700c5ba14f
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Nov 28 22:09:01 EST 2020
git/commit: add -a flag to amend The first change to support editing history. Git/commit -a will now change the contents of a commit, preserving the message. To change the message, use -am 'msg'.
--- a/commit
+++ b/commit
@@ -75,7 +75,9 @@
}
fn parents{
- if(test -f .git/index9/merge-parents)
+ if(! ~ $#amend 0)
+ parents=`{cat /mnt/git/HEAD/parent}
+ if not if(test -f .git/index9/merge-parents)
parents=`{cat .git/index9/merge-parents | sort | uniq}
if not if(~ $initial true)
parents=()
@@ -116,7 +118,7 @@
gitup
-flagfmt='m:msg message'; args='file ...'
+flagfmt='m:msg message, a:amend'; args='file ...'
eval `''{aux/getflags $*} || exec aux/usage
if(~ $#* 0)
exec aux/usage
@@ -124,6 +126,10 @@
msgfile=/tmp/git-msg.$pid
if(~ $#msg 1)
echo $msg >$msgfile.tmp
+if not if(~ $#amend 1){
+ msg=1
+ cat /mnt/git/HEAD/msg >$msgfile.tmp
+}
files=`{git/walk -c `{cleanname $gitrel/$*}}
if(~ $status '' || ~ $#files 0 && ! test -f .git/index9/merge-parents)
--- a/git.1.man
+++ b/git.1.man
@@ -36,6 +36,9 @@
.PP
.B git/commit
[
+.B -a
+]
+[
.B -m msg
]
.I file...
@@ -308,11 +311,22 @@
.PP
.B Git/rm
is an alias for
-.I git/add.
+.IR git/add -r .
.PP
.B Git/commit
-creates a new commit which updates the files passed.
+creates a new commit consisting of all changes to the specified files.
+By default, an editor is opened to prepare the commit message.
+The
+.I -m
+supplies the commit message directly.
+The
+.I -a
+flag amends the contents of the previous commit, reusing the message.
+To a commit message,
+.I -a
+can be used in conjuction with
+.IR -m .
.PP
.B Git/branch