0

i' d like to get all the commit messages (like with git log --format=%s) on a newly created branch. Let' s suppose i' ve 2 commits:

abcd - from yesterday
bcde - from today

. With this code:

while read old new ref; do
    ....
done

old will be 40 zeros, and new will be bcde. How can i get all the commit messages in this case?

Usecase:

git checkout master
git checkout -b new_branch
some_work
git add; git commit
some_other_work
git add; git commit
git push origin new_branch

.

Many thanks.

user2194805
  • 1,201
  • 1
  • 17
  • 35

2 Answers2

1

Well, i could use this if $old is zero:

if [ $old = $z40 ]; then
    old=`$(git rev-list --boundary $newrev --not --all | sed -n 's/^-//p'`
fi

.

user2194805
  • 1,201
  • 1
  • 17
  • 35
1

If i understand well, you want something like this :

while read old new ref; do
    if [[ "${old}" =~ ^0+$ ]]; then
        range="${new}"
    else
        range="${old}..${new}"
    fi
    git log --format=%s "${range}"
done
user285259
  • 111
  • 3