Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to add comment (not message) to the commit via command line?

Jaanus Truuvaart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2022

Hello,

 

Is there any way to add a comment to commit via command line? 

Or is it possible to do it via Sourcetree? 

Everything instructions so far what i have found is only via Bitbucket UI.  

 

Thank you in advance,

 

Jaanus

1 answer

0 votes
Erez Maadani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2022

Hey @Jaanus Truuvaart 

For new commits:
git commit -m "line #1" -m "line #2"

For changing last commit message (given that it was not pushed yet):
git commit --amend -m "This is the updated commit message" 

For changing previous commits, you will need git rebase.

For a more detailed explanation, have a look here: https://www.atlassian.com/git/tutorials/rewriting-history 

Jaanus Truuvaart
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 25, 2022

Hi @Erez Maadani ,

Thank you for the reply, but actually I mean commit comment, not commit message. 

Payload is described here https://confluence.atlassian.com/bitbucketserver0721/event-payload-1115665959.html?utm_campaign=in-app-help&utm_medium=in-app-help&utm_source=stash#Eventpayload-repositoryevents

in  "Commit comment created" section and it's possible to add the comment via api to the commit or in UI, but i'm wondering is there also an option to add it via git command or via Sourcetree?

 Thank you in advance

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events