rfrsc.io/rf/git-generate

git-generate command

Git-generate regenerates a commit from a script kept in the commit message.

Specifically, the topmost commit in the current git repo should have a script preceded by [git-generate] on a line by itself. The script continues until the end of the message or a Change-Id: line. The script starts execution in the root of the git repo.

For example, a commit message might say:

We are moving from Old to New.

[git-generate]
cd some/dir
sed -i '' 's/Old/New/g' *

To regenerate the commit, git-generate resets the working file state to before the commit and then runs the script. The script runs using 'bash -e', so any single command failing will abort the generation.

When a merge conflict occurs while rebasing, git does not stop with the conflicting commit at the top, so git-generate will not find it by default. The -conflict flag tells git-generate to look for the script in the upcoming (conflicting) commit.

Version
v0.0.0-20250314175034-c71790db1500 (latest)
Published
Mar 14, 2025
Platform
linux/amd64
Imports
10 packages
Last checked
3 weeks ago

Tools for package owners.