How to format code of type git in jira issue comments?

Liwei Dai June 29, 2021

Hello, when I paste my code on comments, I typically like to show what I have changed to the original code, meaning pasting the result of running `git diff`. For example:

diff --git a/translation/tensorflow/bert/run_finetune.sh b/translation/tensorflow/bert/run_finetune.sh
index 825e060..ebfec17 100644
--- a/translation/tensorflow/bert/run_finetune.sh
+++ b/translation/tensorflow/bert/run_finetune.sh
@@ -3,7 +3,7 @@
# Dataset: GLUE/MRPC
# Model: bert-base
MODEL="bert-base"
-EPOCHS=${EPOCHS:-3}
+EPOCHS=${EPOCHS:-1}
TRAIN_BATCH_SIZE=16
export BERT_BASE_DIR=models/${MODEL}
export GLUE_DIR=glue_data

In a typical bash console, you can easily see `git diff` properly formatted, e.g. lines started with a `-` will be in color red, lines started with a `+` will be in green color. How can this be done in jira issue comment? I can't find any code type similar. The default is java, I try to modify it to `git`, but it responeded that it is not supported.

I also tried to add nested text formating inside the code block, but still not working. E.g.:

diff --git a/translation/tensorflow/bert/run_finetune.sh b/translation/tensorflow/bert/run_finetune.sh
index 825e060..ebfec17 100644

{color:red}
--- a/translation/tensorflow/bert/run_finetune.sh

{color}

{color:green}
+++ b/translation/tensorflow/bert/run_finetune.sh

{color}
@@ -3,7 +3,7 @@
# Dataset: GLUE/MRPC
# Model: bert-base
MODEL="bert-base"
-EPOCHS=${EPOCHS:-3}
+EPOCHS=${EPOCHS:-1}
TRAIN_BATCH_SIZE=16
export BERT_BASE_DIR=models/${MODEL}
export GLUE_DIR=glue_data

0 answers

Suggest an answer

Log in or Sign up to answer