git - Squash all commits with commit messages that match a certain pattern -
is there way squash git commits commit messages match pattern?
ideally non-interactive - automatic @ command line.
git rebase -i creates todo file , calls editor; it's supposed user edits file , git interprets it. file in well-known format. instead of interactive editor create shell script edits file non-interactively; use sed -i edit in place; use s/// search command find pick commands $pattern , replace them squash commands.
file squash.sh; put pattern (basic regular expression style) there:
#! /bin/sh exec sed -i 's/^pick \([^ ]\+\) $pattern.\+$/squash \1/' $1 command line:
chmod +x squash.sh git_editor=./squash.sh git rebase --interactive $commit_id
Comments
Post a Comment