Rebasing a git history with empty commit messages

前端 未结 6 1886
谎友^
谎友^ 2020-12-14 20:20

I recently converted an svn repository with git svn. Unfortunately the svn history has a number of empty commit messages. This is a problem when I rebase and

6条回答
  •  無奈伤痛
    2020-12-14 20:46

    If you have multiple lines you could also use cat:

    git filter-branch -f --msg-filter \
     'msg=$(cat); if [ "$msg" = "" ]; then echo "Here was an empty commit message"; else echo "$msg"; fi'
    

    This handles commit messages with multiple lines as well as messages that contain empty lines for spacing.

提交回复
热议问题