Hi Tim: This wont work for me because am trying the edit the commit message ,not change the commit message altogether
For example,for a commit message like below,I want to match the "*change://*" line and then replace it with "<*change://problem/12345678> Fix2 passes*" *Commit message:* <change://problem/42465183> [CLONED_FROM_TRAIN ][info] fix fails [Problem] problem1 problem2 [Root Cause] line1 line2 [Scenario/Frequency] Sometimes [Description of Change] line1 line2 line3 [Platforms Impacted] ABCD [Memory/Performance/Power/Security Impact] None [Dependencies] None [Risks] Low [Test Method] -Verified Change-Id: G78f71e543baae4f472f04715e8d307fdfaec09a2 Reviewed-on: https://tech-gerrit.company.com/20125 Tested-by: user name <[email protected]> On Tuesday, July 24, 2018 at 4:12:49 PM UTC-7, Tim Rice wrote: > > > I am looking for a way to automate "git commit --amend" ,my requirement > is > > to update the existing commit by replace a line ,I tried to change > > ".git/COMMIT_EDITMSG" > > but somehow the change doesn't reflect in the "git commit",how can this > be > > autoamted?please advise > > If I understand correctly what you're trying to do, you will wish to use > the `-m|--message` flag. > > Steps for reproductions: > > ~~~ > mkdir /tmp/testing > cd /tmp/testing > git init > printf "%d\n" $RANDOM >> README > x=0 > git add README > git commit -m "Commit #$(( ++x ))" > git log > printf "%d\n" $RANDOM >> README > git add README > git commit -m "Commit #$(( ++x ))" --amend > git log # Notice how there is still only one commit. > ~~~ > > ~ Tim > > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
