A tool to change git history
When I changed the user information, I found that the information in the git commit history was still the original information, so I thought of the method of modifying the git commit history, so I had this tool.
git clone [email protected]:byronogis/change-git-history.git
cd change-git-history
pnpm i
update config.js
to your needs
pnpm start
congif.js
Recommended, resolve the problem of limit
Generate new token
- Repository access --> All repositories
- Permissions / Repository permissions / Metadata --> Access: Read-only
When you set options.request to true(default), you need to set this
You can set them to change the user information. If you don't want to change the user name or email, you can leave it blank.
This is used to match the old user information, and the corresponding index is the same.
You can set it to change the author_date and committer_date, the default is null, which means no change.
The directory where the repositories are located, the default is {USERNAME}_repos
.
You can also set it to an relative path of change-git-history.js
file.
Filter out repositories that do not match the regular The default is null, which means no filtering
you can also use command line options
--option
means true,--no-option
means false
option | description | default |
---|---|---|
request | whether to request repositories info | true |
clone | whether to git clone repositories | true |
fork | whether to include forked repositories | false |
force | whether to force change | false |
push | whether to git push | false |
When you see the following error:
Aborting: Refusing to destructively overwrite repo history since
this does not look like a fresh clone.
(expected freshly packed repo)
Please operate on a fresh clone instead. If you want to proceed
anyway, use --force.
you can use --force
to force change.
But please note that this will clear your target repository git working directory, please back up in advance.
pnpm start --force
# contain forked repositories and force change, and git push
pnpm start --fork --force --push
# no clone repositories, maybe you have cloned before
pnpm start --no-clone
at present:
- user.name
- user.email
- author_date
- committer_date