Re: renormalize histroy with smudge/clean-filter
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Feb 6, 2025, 10:13 UTC
- Message-ID
- <c88b7b54-d032-4d91-95f8-2f139ec45b78@gmail.com>
- In-Reply-To
- <20250205235931.GB30202@raven.inka.de>
Hi Josef
On 05/02/2025 23:59, Josef Wolf wrote:
Show 14 quoted lines
> >> 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