I like to write explanatory git commit messages and if the PR/MR has one single commit, I use the commit message as the body of the Pull Request/Merge Request.
Using the simple git log command displays the commit message but has some padding/indentation:
There is a way to fix this by specifying the format:
git log -1 --pretty='format:%s%n%n%b'
Where:
-
%s
is the subject of the commit message (the first line) -
%n
is adding a new line (so I am adding two) -
%b
is the body of the commit messageο»Ώ
You can make these bash aliases:
alias .lastmsg="git log -1 --pretty='format:%s%n%n%b'"
And in case of MacOS you can directly copy the last message to clipboard:
alias .cplastmsg="git log -1 --pretty='format:%s%n%n%b' | pbcopy"
PS: If you have some vacation days left (or want to work remote from another country) there is still time to buy tickets for Friendly.rb conference. I wrote here about why to participate
Top comments (0)