@@ -1501,11 +1501,59 @@ class FilteringOptions(object):
15011501 ''' ).rstrip ()
15021502
15031503 # Provide a long helpful examples section
1504- example_text = _ ('''EXAMPLES
1504+ example_text = _ ('''CALLBACKS
15051505
1506- To get help:
1507- git-filter-repo --help
1508- ''' )
1506+ All callback functions are of the same general format. For a command line
1507+ argument like
1508+ --foo-callback 'BODY'
1509+
1510+ the following code will be compiled and called:
1511+ def foo_callback(foo):
1512+ BODY
1513+
1514+ Thus, to replace 'Jon' with 'John' in author/committer/tagger names:
1515+ git filter-repo --name-callback 'return name.replace(b"Jon", b"John")'
1516+
1517+ To remove all 'Tested-by' tags in commit (or tag) messages:
1518+ git filter-repo --message-callback 'return re.sub(br"\\ nTested-by:.*", "", message)'
1519+
1520+ To remove all .DS_Store files:
1521+ git filter-repo --filename-callback 'return None if os.path.basename(filename) == b".DS_Store" else filename'
1522+
1523+ For more detailed examples and explanations AND caveats, see
1524+ https://github.com/newren/git-filter-repo#callbacks
1525+
1526+ EXAMPLES
1527+
1528+ To get a bunch of reports mentioning renames that have occurred in
1529+ your repo and listing sizes of objects aggregated by any of path,
1530+ directory, extension, or blob-id:
1531+ git filter-repo --analyze
1532+
1533+ (These reports can help you choose how to filter your repo; it can
1534+ be useful to re-run this command after filtering to regenerate the
1535+ report and verify the changes look correct.)
1536+
1537+ To extract the history that touched just 'guides' and 'tools/releases':
1538+ git filter-repo --path guides/ --path tools/releases
1539+
1540+ To remove foo.zip and bar/baz/zips from every revision in history:
1541+ git filter-repo --path foo.zip --path bar/baz/zips/ --invert-paths
1542+
1543+ To replace the text 'password' with 'p455w0rd':
1544+ git filter-repo --replace-text <(echo "password==>p455w0rd")
1545+
1546+ To use the current version of the .mailmap file to update authors,
1547+ committers, and taggers throughout history and make it permanent:
1548+ git filter-repo --use-mailmap
1549+
1550+ To extract the history of 'src/', rename all files to have a new leading
1551+ directory 'my-module' (e.g. src/foo.java -> my-module/src/foo.java), and
1552+ add a 'my-module-' prefix to all tags:
1553+ git filter-repo --path src/ --to-subdirectory-filter my-module --tag-rename '':'my-module-'
1554+
1555+ For more detailed examples and explanations, see
1556+ https://github.com/newren/git-filter-repo#examples''' )
15091557
15101558 # Create the basic parser
15111559 parser = argparse .ArgumentParser (description = summary ,
0 commit comments