简体   繁体   中英

How can I append a line to a git commit message from the command line?

I'd like to append (leaving the rest of the commit message intact) a line to my last commit from the command line (ie without having to open my editor). Is there anyway to do this?

Example commit:

git commit -m 'foo'
#foo 

Appending the string bar :

git commit --amend -m "$(git log --format=%B -n 1) bar"
#foo bar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM