README
restory
rewrite git history
install
yarn add @tool3/restory -g
or
npx @tool3/restory <cmd> [args] [options]
features
restory
uses it's own dist of git-filter-repo
and therefore doesn't rely on you having it.
- super fast
- simple api
- standalone
api
list
list all commits
alias ls
example
restory ls
output:
show 5 last commits
restory ls -n 5
redate
rewrite commit|s date
alias rd
usage
restory redate [string-to-replace] <value>
examples
- rewrite all commits that has
2021
to year to1987
restory redate 2021 1987
NOTE: this will also automagically update the day and month
- rewrites a specific commit's day
restory redate 'Sat Jan 23' 'Sun Jan 24' -s <commit-sha>
- rewrites the last 5 commits date to now
restory redate "$(echo `date`)" -n 5
reauthor
rewrite commit|s author name
alias ra
usage
restory reauthor <author-name>
example
rewrite all commit author names to The Devil
restory reauthor 'The Devil'
rewrite last 5 commits author to Jebediah Kerman
restory reauthor 'Jebediah Kerman' -n 5
remail
rewrite commit|s author email
alias re
usage
restory remail <author-email>
example
rewrite all commit author email to thedevil@666.com
restory remail 'thedevil@666.com'
remsg
rewrite commit|s message
alias rm
usage
restory remsg <commit-msg>
example
rewrite specific commit message
restory remsg 'this is the new commit msg' -s '620a83b'
options
sha
type: string
alias: s
description: rewrite a specific commit sha.
usage: restory <cmd> [args] -s <short-sha>
range
type: array
alias: r
description: range of commits to operate on.
usage: restory <cmd> [args] -r <start-sha> <end-sha>
number
type: number
alias: n
description: number of commits.
default: 0 (all commits)
usage: restory <cmd> [args] -n <number>
committer
type: boolean
alias: c
description: include committer fields. for example: author_date
will also include committer_date
in the rewrite.
default: true
git-filter-repo
type: boolean
alias: g
description: use git filter-repo
insteads of git filter-branch
- this method is extremely fast compared to filter-branch.
default: true
important usage notes
⚠️ ATTENTION! THIS WILL REWRITE YOUR GIT HISTORY! ⚠️
use at your own risk
things to know:
- every
restory
command recreates the commit|s shas. - you need to have a clean working directory.
- you will have to force push.
- when run without
--sha || -s
flag - the command will rewrite ALL commits with given input.