Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Current code to generate change logs:

svn2cl --linelen 78 --reparagraph --include-rev --group-by-day

The closest I could get with vanilla options is

git shortlog --format='* [%h] %s' -w78,8,10

How do I emulate the svn2cl output as closely as possible?

Example output:

2013-02-19  username

        * [r30695] path1: commit message
        * [r30691] path2, path3, path4: looooooooooooooooooooooooooooong
          commit message
        * [r30690] path1, path3: commit message

2013-02-19  other_user
        * ...

2013-02-18  username
        * ...

Two issues remain:

  • Include a human-readable list of paths before the commit message
  • Pretty-print long commit messages
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Another solution gave the right direction. The result so far:

#!/usr/bin/env bash
while read -r -u 9 date name
do
    echo "$date  $name"
    echo
    GIT_PAGER=cat git log --no-merges --committer="$name" --since="$date 00:00:00 +0000" --until="$(date --date="$date + 1 day" +%Y-%m-%d) 00:00:00 +0000" --format='        * [%h] %s'
    echo
done 9< <(git log --no-merges --format=$'%cd %cn' --date=short | sort --unique --reverse)

The midnight times were necessary. It looks like for some reason it uses the current time instead of the start of the day by default.

Two issues remain:

  • Include a human-readable list of paths before the commit message
  • Pretty-print long commit messages

Sample output:

2013-02-19  username

        * [f97bb5f] commit message
        * [f0e419d] looooooooooooooooooooooooooooong commit message
        * [070e50f] commit message

2013-02-19  other_user
        * ...

2013-02-18  username
        * ...
share|improve this answer

In order to get this to work on OS X, I made some minor modifications to l0b0's solution:

git-grouped-log () {
  while read -r -u 9 since name
  do
    until=$(date -j -v+1d -f '%Y-%m-%d' $since +%Y-%m-%d)

    echo "$since $name"
    echo

    GIT_PAGER=cat git log             \
      --no-merges                     \
      --committer="$name"             \
      --since="$since 00:00:00 +0000" \
      --until="$until 00:00:00 +0000" \
      --format='  * [%h] %s'

    echo
  done 9< <(git log --no-merges --format=$'%cd %cn' --date=short | sort --unique --reverse)
}

I also wrapped it in a function, because then I can save it in an arbitrary file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.