8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

filter-branchで指定した範囲のコミットログを修正する

Last updated at Posted at 2015-05-25

ブランチの作業の途中でBacklogからRedmineに移行して、コミットコメントの記述方法に関する運用ルールが変わった。
featureをrefに直せば良さそうだったので、作業中のブランチに適用することに。
git rebase -i でひとつずつ修正するのでも良いですが、一括で修正する方法を試してみたかった。

結果的には、修正したい開始点と終点にテンポラリでブランチを作って、範囲にブランチ名を指定する形で成功した。
HEAD~8..HEAD~32という参照がうまく効かなくてハマった。

結論

git filter-branch --msg-filter '
  sed -e "s/^feature.*$/ref\ #146/"
'  tmp2..tmp

tmp2の方が過去。
featureで始まる行をref 146 に書き換えている。

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?