Skip to content

Append a commit or rewrite all commits ? #54

@ewjoachim

Description

@ewjoachim

(disclamer: rewriting history of merged commits is bad, I know, just exploring the idea for the sake of it)

In the one hand, rewriting history is bad. But in the other a huge big bang commit is equally bad for being able to use git blame and understanding where a commit comes from.

So I would find it interesting to be able to retrospectively blacken all commits in git history one by one in a PR. Or if you're YOLO, for the whole repo.

For the whole repo, this can be done with git filter-branch --tree-filter "git ls-files |xargs black" -- --all. (it a similar construct for a single PR with something instead of --all, probably <target-branch>..<pr-branch> but I haven't tried). But in real life you don't want to rewrite history of your whole repo, that would be bad.

This would mean the bot would rewrite commits but as far as I can tell, git filter-tree doesn't change the committer, so it wouldn't appear as co-author (we could add a Co-Authored-By` field, though). But, quite logically, this removes GPG signature from commits and tags. And rewriting the whole repo is madness, did I mention it ? Would be cool still. 🙃

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions