Skip to content

Is --preserve-commit-hashes working ok? #666

@digerzo

Description

@digerzo

Hello everyone,

I have a use case in where a fork from a public repo needs to be pushed into a private repo, but with a certain string inside the commit message, lets say, APRED101. I've managed to re write the git history using filter-repo as:

$ git-filter-repo --preserve-commit-hashes --source <path to local-public repo> --commit-callback ../commit-message-callback.py --refs HEAD

Inside file commit-message-callback.py I've put:

msg = commit.message.decode("utf-8")
newmsg = "APRED101: " + msg
commit.message = newmsg.encode("utf-8")

In this use case, I need to also maintain the history of the original public repo, so in the future I can pull updates. I was wondering to use --preserve-commit-hashes to actually keep the original commit sha1 and thus, accomplish this requirement. But this is not working as I expect, since the outcome history has all the messages with new messages, but with different commit sha1.

Is this the expected use to --preserve-commit-hashes?

Regards,
Agustin

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