scripting - Using git filter-branch to rewrite authors/committers and commit messages simultaneously -
I have a Git repository that is originally imported from subversion. Some parts of the information of the author / commutator are incorrect, which is not a mistake of GET but is mostly due to earning sloppies with Subversion.
I rewrite the history of the repository, communicator and author's information.
There is a problem ... I need to embrace the author's information with a comment message i as far as I can tell, git filter-branch
Allows you to filter the author information (with - env-filter
) and / or commit commitments (with - msg-filter
) , But not together with the information shared between individual filters, to simultaneously combine both together.
That's why I'm kind of stymied about how to do this ... best I can think that it can do in many different ways: First, gather all the messages, then make a script And filter all author / committee information. It appears to be very insensitive and error, so I am thinking that someone else has done this kind of work more easily. = "Text">
The only thing I can consider getting it in one pass is to use a committed filter. Like a message filter, it takes a log message on stdin, so you will be able to parse it and find out what you need. Then you can set the appropriate variable to yourself and call yourself git commit-tree
. (The committee filter is essentially a drop-in replacement for the comment-tree, the same takes the argument and produces the same output.)
In the Bash, this would be something like this:
messages = $ (read_from_stdin) modify_env_vars "$ message" echo "$ message" | Git commit-tree "$ @"
I've never tried to do this, but I do not know why it will not work, suppose you have to do these two shell works Write properly!
(And just a small note - it is not enough that - env-filter
and - msg-filter
can not affect each other , That they always run in that order. Therefore, the first filters can leave behind or behind in order to see the other side in the environment, but they are in an order that prevents you from doing your will.)
Comments
Post a Comment