From: Phillip Wood Date: Thu, 06 Feb 2025 10:13:43 GMT Subject: Re: renormalize histroy with smudge/clean-filter Message-ID: In-Reply-To: <20250205235931.GB30202@raven.inka.de> Hi Josef On 05/02/2025 23:59, Josef Wolf wrote: > >> git rebase --root -x 'git add --renormalize . && git commit --amend --no-edit' > > Unfortunately, this runs the command on every commit and gives a warning when > a cmmit don't touch a filtered file: > > $ git rebase --root -x 'git add --renormalize . && git commit --amend --no-edit' > [ ... ] > No changes > You asked to amend the most recent commit, but doing so would make > it empty. You can repeat your command with --allow-empty, or you can > remove the commit entirely with "git reset HEAD^". > > Is there a way to run the command only when rebase halts? You could try using "git diff --cached --quiet" to avoid running "git commit" if there are no changes. git rebase --root -x 'git add --renormalize . && { git diff --quiet --cached || git commit --amend --no-edit; }' Best Wishes Phillip