Skip to contentSkip to conversation

How to edit commit messages?

DISCUSSION [email protected] 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi all,
  what are the best solution to:
1) interactively edit commit's messages (some or all)
2) batch edit commit's messages (for example using sed)

My repo is not published yet, so there is no problem in rewriting all history.

Thanks in advance

#1 lore raw
Quoted 1 line · On Tue, Aug 12, 2008 at 02:38:32PM +0200, [email protected] wrote:

1) interactively edit commit's messages (some or all)

git rebase -i

Quoted 1 line

2) batch edit commit's messages (for example using sed)

git filter-branch

#2 lore raw
In reply to [email protected]
Quoted 8 lines · [email protected] wrote:

Hi all,
what are the best solution to:
1) interactively edit commit's messages (some or all)
2) batch edit commit's messages (for example using sed)

My repo is not published yet, so there is no problem in rewriting all history.

git filter-branch --msg-filter 'sed s/foo/bar/g' master

to replace all occurrences of foo with bar in all commit messages for all commits made on the master branch.

Signature · 3 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
#3 lore raw
In reply to [email protected]
Quoted 3 lines · [email protected] writes:

Hi all,
  what are the best solution to:
1) interactively edit commit's messages (some or all)

git rebase -i

can help.

Quoted 1 line

2) batch edit commit's messages (for example using sed)

  git filter-branch --msg-filter sed 's/foo/bar/'

should do it.

Signature · 1 line
Matthieu