I'm not good at bash, and what I was trying to do is to get information from git log --name-status branch_one...branch_two and after that split output by commits, for example:
git_command_output="
commit one
Author: Johny
Date: 01/01/1999
feat: add something
M src/some_file.txt
commit two
Author: Alex
Date: 02/01/1999
fix: bug
M src/some_file.txt"
From the above I would want to create and array of strings, where each string will be information about one commit.
For instance array would look something like that:
echo "${array[0]}"
# Author: Johny
# Date: 01/01/1999
# feat: add something
# M src/my_file.txt
echo "${array[1]}"
# Author: Alex
# Date: 02/01/1999
# fix: bug
# M src/foreign_file.txt
What I tried (didn't work):
array[0]=$(echo "$git_command_output" | awk '{split($0, array, "commit"); print array[0]}')
IFS='commit' read -r -a array <<< "$git_command_output"
Is there a concise way to do it, preferably using awk?